Skip to content

Commit ba899dc

Browse files
Merge pull request #12 from DeDuckProject/styling
Styling
2 parents f60d63f + 2238adc commit ba899dc

20 files changed

Lines changed: 1387 additions & 461 deletions

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
"mathjs": "^14.4.0",
1515
"react": "^19.0.0",
1616
"react-dom": "^19.0.0",
17-
"react-hotkeys-hook": "^5.0.1"
17+
"react-hotkeys-hook": "^5.0.1",
18+
"react-xarrows": "^2.0.2"
1819
},
1920
"devDependencies": {
2021
"@eslint/js": "^9.21.0",
2122
"@jest/globals": "^29.7.0",
23+
"@testing-library/dom": "^10.4.0",
2224
"@testing-library/jest-dom": "^6.6.3",
2325
"@testing-library/react": "^16.3.0",
2426
"@testing-library/user-event": "^14.6.1",

src/components/App.css

Lines changed: 93 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
/* Main App Layout */
22
.app-container {
3-
font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
3+
font-family: var(--font-family);
44
max-width: 1200px;
55
margin: 0 auto;
6-
padding: 20px;
7-
background: linear-gradient(to bottom, #f9f9f9, #e9e9e9);
6+
padding: 28px;
7+
background-color: var(--card-bg);
88
min-height: 100vh;
9-
color: #333;
9+
color: var(--text-color);
10+
border-radius: var(--border-radius);
11+
box-shadow: var(--box-shadow);
1012
}
1113

1214
header {
1315
text-align: center;
14-
margin-bottom: 30px;
15-
padding-bottom: 20px;
16-
border-bottom: 1px solid #ddd;
16+
margin-bottom: 32px;
17+
padding-bottom: 24px;
18+
border-bottom: 1px solid var(--soft-gray);
1719
}
1820

1921
header h1 {
20-
color: #2c3e50;
21-
margin-bottom: 5px;
22+
color: var(--secondary-color);
23+
font-size: 32px;
24+
font-weight: 700;
25+
margin-bottom: 8px;
2226
}
2327

2428
header h2 {
25-
color: #3498db;
26-
font-weight: normal;
29+
color: var(--primary-color);
30+
font-weight: 500;
31+
font-size: 18px;
2732
}
2833

2934
main {
@@ -49,58 +54,110 @@ main {
4954
/* Simulation Display */
5055
.simulation-display {
5156
flex: 1;
52-
padding: 25px;
53-
background-color: white;
54-
border-radius: 12px;
55-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
57+
padding: 28px;
58+
background-color: var(--card-bg);
59+
border-radius: var(--border-radius);
60+
box-shadow: var(--box-shadow);
5661
}
5762

5863
.simulation-display h2 {
59-
color: #2c3e50;
64+
color: var(--secondary-color);
65+
font-size: 24px;
66+
font-weight: 600;
6067
margin-top: 0;
6168
margin-bottom: 20px;
6269
padding-bottom: 10px;
63-
border-bottom: 2px solid #3498db;
70+
border-bottom: 2px solid var(--primary-color);
6471
}
6572

6673
/* Messages */
6774
.fidelity-info {
68-
margin-top: 30px;
69-
padding: 15px;
75+
margin-top: 32px;
76+
padding: 20px;
7077
background-color: #f8f9fa;
71-
border-radius: 8px;
72-
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
78+
border-radius: var(--border-radius);
79+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.03);
7380
}
7481

7582
.fidelity-info h3 {
76-
color: #2c3e50;
83+
color: var(--secondary-color);
84+
font-size: 18px;
85+
font-weight: 600;
7786
margin-top: 0;
78-
margin-bottom: 10px;
87+
margin-bottom: 12px;
7988
}
8089

8190
.completion-message {
82-
padding: 15px;
83-
background-color: #d4edda;
84-
color: #155724;
85-
border-radius: 8px;
91+
padding: 16px 20px;
92+
background-color: rgba(16, 185, 129, 0.1);
93+
color: var(--highlight-green);
94+
border-radius: var(--border-radius);
8695
margin-top: 20px;
87-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
88-
border-left: 5px solid #28a745;
96+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
97+
border-left: 4px solid var(--highlight-green);
8998
animation: fadeIn 0.5s;
9099
}
91100

92101
.completion-message.error {
93-
background-color: #f8d7da;
94-
color: #721c24;
95-
border-left-color: #dc3545;
102+
background-color: rgba(239, 68, 68, 0.1);
103+
color: #dc2626;
104+
border-left-color: #dc2626;
96105
}
97106

98107
/* Footer */
99108
footer {
100-
margin-top: 40px;
109+
margin-top: 48px;
101110
text-align: center;
102111
font-size: 14px;
103-
color: #777;
104-
padding: 20px;
105-
border-top: 1px solid #eee;
112+
color: #94a3b8;
113+
padding: 24px;
114+
border-top: 1px solid var(--soft-gray);
115+
}
116+
117+
/* Mobile responsive styles */
118+
@media (max-width: 768px) {
119+
.app-container {
120+
padding: 16px;
121+
border-radius: 0;
122+
}
123+
124+
header h1 {
125+
font-size: 24px;
126+
}
127+
128+
header h2 {
129+
font-size: 16px;
130+
}
131+
132+
main {
133+
padding-top: 20px; /* Add space for the fixed toggle button */
134+
}
135+
136+
.simulation-area {
137+
flex-direction: column;
138+
gap: 16px;
139+
}
140+
141+
/* The drawer now handles the control panel display independently */
142+
.simulation-area > :nth-child(2) {
143+
width: 100%;
144+
}
145+
146+
.simulation-display {
147+
padding: 16px;
148+
}
149+
150+
.drawer-toggle.open {
151+
display: none;
152+
}
153+
154+
.drawer-overlay {
155+
position: fixed;
156+
top: 0;
157+
left: 0;
158+
width: 100%;
159+
height: 100vh;
160+
background-color: rgba(0, 0, 0, 0.5);
161+
z-index: 900;
162+
}
106163
}

src/components/App.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const App: React.FC = () => {
1010
const [controller, setController] = useState<SimulationController | null>(null);
1111
const [engineType, setEngineType] = useState<EngineType>(EngineType.Average);
1212
const [viewBasis, setViewBasis] = useState<Basis>(Basis.Bell);
13+
const [drawerOpen, setDrawerOpen] = useState(false);
1314

1415
useEffect(() => {
1516
// Initialize controller with default parameters
@@ -44,8 +45,25 @@ const App: React.FC = () => {
4445
</header>
4546

4647
<main>
48+
{drawerOpen && (
49+
<div
50+
data-testid="drawer-overlay"
51+
className="drawer-overlay"
52+
onClick={() => setDrawerOpen(false)}
53+
/>
54+
)}
55+
<button
56+
className={`drawer-toggle${drawerOpen ? ' open' : ''}`}
57+
aria-label="Toggle controls"
58+
onClick={() => setDrawerOpen(o => !o)}
59+
>
60+
61+
</button>
4762
<div className="simulation-area">
4863
<ControlPanel
64+
className={drawerOpen ? 'open' : ''}
65+
isDrawerOpen={drawerOpen}
66+
onDrawerClose={() => setDrawerOpen(false)}
4967
onNextStep={() => controller.nextStep()}
5068
onCompleteRound={() => controller.completeRound()}
5169
onRunAll={() => controller.runUntilComplete()}

0 commit comments

Comments
 (0)