Skip to content

Commit 0b4928f

Browse files
chapterjasonclaude
andcommitted
Extract shared demo styles into src/demo.css
Hoists the overlapping nav/layout rules into one stylesheet and themes via CSS variables switched by a body.theme-dark class, so the two demo pages keep only the rules specific to their content (textarea vs #term). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b07d89b commit 0b4928f

3 files changed

Lines changed: 70 additions & 16 deletions

File tree

src/demo.css

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
:root {
2+
--nav-bg: #f3f4f6;
3+
--nav-border: #e5e7eb;
4+
--nav-link: #2563eb;
5+
--body-bg: transparent;
6+
--body-fg: inherit;
7+
}
8+
9+
body.theme-dark {
10+
--nav-bg: #111827;
11+
--nav-border: #1f2937;
12+
--nav-link: #93c5fd;
13+
--body-bg: #0b1220;
14+
--body-fg: #cbd5e1;
15+
}
16+
17+
html,
18+
body {
19+
height: 100%;
20+
margin: 0;
21+
font-family: system-ui, sans-serif;
22+
}
23+
24+
body {
25+
display: flex;
26+
flex-direction: column;
27+
background: var(--body-bg);
28+
color: var(--body-fg);
29+
}
30+
31+
.nav {
32+
padding: 10px 16px;
33+
font-size: 14px;
34+
background: var(--nav-bg);
35+
border-bottom: 1px solid var(--nav-border);
36+
display: flex;
37+
gap: 12px;
38+
align-items: center;
39+
}
40+
41+
.nav a {
42+
color: var(--nav-link);
43+
text-decoration: none;
44+
}
45+
46+
.nav a:hover {
47+
text-decoration: underline;
48+
}
49+
50+
.nav .status {
51+
margin-left: auto;
52+
color: #94a3b8;
53+
font-size: 12px;
54+
}
55+
56+
.demo {
57+
flex: 1;
58+
display: flex;
59+
flex-direction: column;
60+
min-height: 0;
61+
padding: 12px;
62+
}
63+
64+
virtual-keyboard {
65+
flex: none;
66+
}

src/index.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
66
<meta name="mobile-web-app-capable" content="yes" />
77
<title>Virtual Keyboard</title>
8+
<link rel="stylesheet" href="./demo.css" />
89
<style>
9-
html, body { height: 100%; margin: 0; font-family: system-ui, sans-serif; }
10-
body { display: flex; flex-direction: column; }
11-
.nav { padding: 10px 16px; font-size: 14px; background: #f3f4f6; border-bottom: 1px solid #e5e7eb; }
12-
.nav a { color: #2563eb; text-decoration: none; margin-right: 12px; }
13-
.nav a:hover { text-decoration: underline; }
14-
.demo { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
10+
.demo { padding: 16px; gap: 12px; }
1511
.demo textarea {
1612
flex: 1; min-height: 120px; padding: 12px; font-size: 16px;
1713
border: 1px solid #ccc; border-radius: 8px; resize: none;
1814
}
19-
virtual-keyboard { flex: none; }
2015
</style>
2116
</head>
2217
<body>

src/linux.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
66
<meta name="mobile-web-app-capable" content="yes" />
77
<title>Virtual Keyboard — Linux (v86)</title>
8+
<link rel="stylesheet" href="./demo.css" />
89
<style>
9-
html, body { height: 100%; margin: 0; background: #0b1220; color: #cbd5e1; font-family: system-ui, sans-serif; }
10-
body { display: flex; flex-direction: column; }
11-
.nav { padding: 10px 16px; font-size: 14px; background: #111827; border-bottom: 1px solid #1f2937; display: flex; gap: 12px; align-items: center; }
12-
.nav a { color: #93c5fd; text-decoration: none; }
13-
.nav a:hover { text-decoration: underline; }
14-
.nav .status { margin-left: auto; color: #94a3b8; font-size: 12px; }
15-
.demo { flex: 1; padding: 12px; display: flex; flex-direction: column; min-height: 0; }
1610
#term { flex: 1; min-height: 0; }
17-
virtual-keyboard { flex: none; }
1811
</style>
1912
</head>
20-
<body>
13+
<body class="theme-dark">
2114
<div class="nav">
2215
<a href="./index.html">← Native</a>
2316
<span>Linux (busybox on v86 · x86 WASM)</span>

0 commit comments

Comments
 (0)