Skip to content

Commit 0c505a8

Browse files
committed
インラインstyleを外部CSSに移した
1 parent 1553ba7 commit 0c505a8

2 files changed

Lines changed: 97 additions & 49 deletions

File tree

src/pages/Simulation/index.css

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
.simulation-page {
2+
position: relative;
3+
width: 100vw;
4+
height: 100vh;
5+
}
6+
7+
.simulation-panel {
8+
position: absolute;
9+
top: 16px;
10+
left: 16px;
11+
width: 320px;
12+
max-height: 75vh;
13+
overflow-y: auto;
14+
background: rgba(0, 0, 0, 0.7);
15+
color: #ffffff;
16+
border-radius: 8px;
17+
padding: 12px;
18+
backdrop-filter: blur(4px);
19+
font-size: 14px;
20+
}
21+
22+
.simulation-panel__header {
23+
display: flex;
24+
align-items: center;
25+
justify-content: space-between;
26+
}
27+
28+
.simulation-panel__actions {
29+
display: flex;
30+
align-items: center;
31+
gap: 8px;
32+
}
33+
34+
.simulation-panel__toggle {
35+
display: flex;
36+
align-items: center;
37+
gap: 6px;
38+
}
39+
40+
.simulation-panel__button {
41+
border: 1px solid rgba(255, 255, 255, 0.35);
42+
border-radius: 6px;
43+
background: transparent;
44+
color: #ffffff;
45+
padding: 2px 8px;
46+
cursor: pointer;
47+
font-size: 12px;
48+
}
49+
50+
.simulation-panel__hint {
51+
margin-top: 8px;
52+
margin-bottom: 12px;
53+
opacity: 0.85;
54+
}
55+
56+
.simulation-panel__list {
57+
list-style: none;
58+
padding: 0;
59+
margin-top: 10px;
60+
margin-bottom: 0;
61+
}
62+
63+
.simulation-panel__item {
64+
display: flex;
65+
align-items: center;
66+
justify-content: space-between;
67+
gap: 8px;
68+
margin-bottom: 8px;
69+
padding-bottom: 8px;
70+
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
71+
}
72+
73+
.simulation-panel__meta {
74+
font-size: 12px;
75+
opacity: 0.85;
76+
}
77+
78+
.simulation-panel__delete {
79+
border: 1px solid rgba(255, 255, 255, 0.35);
80+
border-radius: 6px;
81+
background: transparent;
82+
color: #ffffff;
83+
padding: 4px 8px;
84+
cursor: pointer;
85+
}

src/pages/Simulation/index.tsx

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { button, useControls } from "leva";
55
import * as THREE from "three";
66
import type { Planet } from "@/types/planet";
77
import { earth } from "@/data/planets";
8+
import "./index.css";
89

910
interface PlanetMeshProps {
1011
planet: Planet;
@@ -144,7 +145,7 @@ export default function Page() {
144145
};
145146

146147
return (
147-
<div style={{ position: "relative", width: "100vw", height: "100vh" }}>
148+
<div className="simulation-page">
148149
<Canvas
149150
camera={{ position: [0, 0, 220], fov: 60 }}
150151
onCreated={({ gl }) => {
@@ -175,26 +176,11 @@ export default function Page() {
175176
<OrbitControls enableZoom={true} />
176177
</Canvas>
177178

178-
<div
179-
style={{
180-
position: "absolute",
181-
top: 16,
182-
left: 16,
183-
width: 320,
184-
maxHeight: "75vh",
185-
overflowY: "auto",
186-
background: "rgba(0, 0, 0, 0.7)",
187-
color: "#ffffff",
188-
borderRadius: 8,
189-
padding: 12,
190-
backdropFilter: "blur(4px)",
191-
fontSize: 14,
192-
}}
193-
>
194-
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
179+
<div className="simulation-panel">
180+
<div className="simulation-panel__header">
195181
<strong>クリック配置</strong>
196-
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
197-
<label style={{ display: "flex", alignItems: "center", gap: 6 }}>
182+
<div className="simulation-panel__actions">
183+
<label className="simulation-panel__toggle">
198184
<input
199185
type="checkbox"
200186
checked={placementMode}
@@ -205,44 +191,28 @@ export default function Page() {
205191
<button
206192
type="button"
207193
onClick={() => setPlacementPanelOpen((prev) => !prev)}
208-
style={{
209-
border: "1px solid rgba(255, 255, 255, 0.35)",
210-
borderRadius: 6,
211-
background: "transparent",
212-
color: "#ffffff",
213-
padding: "2px 8px",
214-
cursor: "pointer",
215-
fontSize: 12,
216-
}}
194+
className="simulation-panel__button"
217195
>
218196
{placementPanelOpen ? "たたむ" : "ひらく"}
219197
</button>
220198
</div>
221199
</div>
222200
{placementPanelOpen && (
223201
<>
224-
<p style={{ marginTop: 8, marginBottom: 12, opacity: 0.85 }}>
202+
<p className="simulation-panel__hint">
225203
ONの間は水色の面をクリックすると、座標が自動入力されます。
226204
</p>
227205

228206
<strong>追加済み惑星 ({planets.length})</strong>
229-
<ul style={{ listStyle: "none", padding: 0, marginTop: 10, marginBottom: 0 }}>
207+
<ul className="simulation-panel__list">
230208
{planets.map((planet, index) => (
231209
<li
232210
key={`planet-item-${index}`}
233-
style={{
234-
display: "flex",
235-
alignItems: "center",
236-
justifyContent: "space-between",
237-
gap: 8,
238-
marginBottom: 8,
239-
paddingBottom: 8,
240-
borderBottom: "1px solid rgba(255, 255, 255, 0.15)",
241-
}}
211+
className="simulation-panel__item"
242212
>
243213
<div>
244214
<div>#{index + 1}</div>
245-
<div style={{ fontSize: 12, opacity: 0.85 }}>
215+
<div className="simulation-panel__meta">
246216
r={planet.radius.toFixed(1)} / (
247217
{planet.position.x.toFixed(1)}, {planet.position.y.toFixed(1)},
248218
{planet.position.z.toFixed(1)})
@@ -251,14 +221,7 @@ export default function Page() {
251221
<button
252222
type="button"
253223
onClick={() => removePlanet(index)}
254-
style={{
255-
border: "1px solid rgba(255, 255, 255, 0.35)",
256-
borderRadius: 6,
257-
background: "transparent",
258-
color: "#ffffff",
259-
padding: "4px 8px",
260-
cursor: "pointer",
261-
}}
224+
className="simulation-panel__delete"
262225
>
263226
削除
264227
</button>

0 commit comments

Comments
 (0)