forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
Implement P2P polling app with Yjs and WebRTC
Uses Yjs CRDTs for conflict-free shared state and y-webrtc for peer-to-peer data exchange. Users can add poll options and vote/unvote, with all changes syncing in real-time across connected peers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
144
src/style.css
Normal file
144
src/style.css
Normal file
@@ -0,0 +1,144 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
background: #f5f5f5;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
#app {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
#status {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
#connection-status::before {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
margin-right: 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#connection-status.connected::before {
|
||||
background: #4caf50;
|
||||
}
|
||||
|
||||
#connection-status.connecting::before {
|
||||
background: #ff9800;
|
||||
}
|
||||
|
||||
#add-option {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
#option-input {
|
||||
flex: 1;
|
||||
padding: 0.6rem 0.8rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#option-input:focus {
|
||||
border-color: #2196f3;
|
||||
}
|
||||
|
||||
#add-btn {
|
||||
padding: 0.6rem 1.2rem;
|
||||
background: #2196f3;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#add-btn:hover {
|
||||
background: #1976d2;
|
||||
}
|
||||
|
||||
.poll-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: white;
|
||||
padding: 0.8rem 1rem;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 0.5rem;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.option-name {
|
||||
flex: 1;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.vote-count {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
color: #666;
|
||||
margin-right: 0.75rem;
|
||||
min-width: 1.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vote-btn {
|
||||
padding: 0.4rem 1rem;
|
||||
border: 2px solid #2196f3;
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
background: white;
|
||||
color: #2196f3;
|
||||
}
|
||||
|
||||
.vote-btn:hover {
|
||||
background: #e3f2fd;
|
||||
}
|
||||
|
||||
.vote-btn.voted {
|
||||
background: #2196f3;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.vote-btn.voted:hover {
|
||||
background: #1976d2;
|
||||
}
|
||||
|
||||
#empty-state {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
#empty-state.hidden {
|
||||
display: none;
|
||||
}
|
||||
Reference in New Issue
Block a user