Skip to content

Commit bc3acff

Browse files
committed
style: enhance LiveDemo component with improved layout and styling
1 parent 6f91877 commit bc3acff

1 file changed

Lines changed: 69 additions & 25 deletions

File tree

docs/src/components/LiveDemo.astro

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -146,26 +146,36 @@
146146
.demo-controls {
147147
background: var(--sl-color-bg-sidebar);
148148
border: 1px solid var(--sl-color-gray-5);
149-
border-radius: 0.5rem;
150-
padding: 1.5rem;
149+
border-radius: 0.75rem;
150+
padding: 2rem;
151151
margin-bottom: 1.5rem;
152152
display: flex;
153153
flex-direction: column;
154-
gap: 1.25rem;
154+
gap: 1.5rem;
155+
}
156+
157+
@media (max-width: 768px) {
158+
.demo-controls {
159+
padding: 1.25rem;
160+
}
155161
}
156162

157163
.control-row {
158-
display: flex;
159-
flex-wrap: wrap;
164+
display: grid;
165+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
160166
gap: 1rem;
161167
}
162168

163169
.control-item {
164170
display: flex;
165171
flex-direction: column;
166172
gap: 0.25rem;
167-
flex: 1;
168-
min-width: 140px;
173+
}
174+
175+
@media (max-width: 768px) {
176+
.control-row {
177+
grid-template-columns: 1fr;
178+
}
169179
}
170180

171181
.control-item label {
@@ -176,46 +186,68 @@
176186

177187
.control-item input,
178188
.control-item select {
179-
padding: 0.4rem 0.6rem;
189+
padding: 0.5rem 0.75rem;
180190
border: 1px solid var(--sl-color-gray-4);
181-
border-radius: 0.25rem;
191+
border-radius: 0.375rem;
182192
background: var(--sl-color-bg);
183193
color: var(--sl-color-text);
184-
font-size: 0.9rem;
194+
font-size: 0.95rem;
195+
transition: border-color 0.2s ease;
196+
}
197+
198+
.control-item input:focus,
199+
.control-item select:focus {
200+
outline: none;
201+
border-color: var(--sl-color-text-accent);
185202
}
186203

187204
.control-item input[type="color"] {
188-
padding: 0.2rem;
189-
height: 2rem;
205+
padding: 0.25rem;
206+
height: 2.5rem;
190207
cursor: pointer;
191208
}
192209

193210
.control-group {
194211
display: flex;
195212
flex-direction: column;
196-
gap: 0.5rem;
213+
gap: 0.75rem;
214+
padding: 1rem;
215+
background: var(--sl-color-bg);
216+
border-radius: 0.375rem;
217+
border: 1px solid var(--sl-color-gray-5);
218+
}
219+
220+
.control-group .control-row {
221+
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
197222
}
198223

199224
.control-group-label {
200-
font-size: 0.85rem;
201-
font-weight: 600;
225+
font-size: 0.9rem;
226+
font-weight: 700;
202227
color: var(--sl-color-text);
228+
margin-bottom: 0.25rem;
203229
}
204230

205231
.demo-btn {
206232
align-self: flex-start;
207-
padding: 0.5rem 1.25rem;
233+
padding: 0.65rem 1.5rem;
208234
background: var(--sl-color-text-accent);
209235
color: var(--sl-color-bg);
210236
border: none;
211-
border-radius: 0.25rem;
212-
font-size: 0.9rem;
237+
border-radius: 0.375rem;
238+
font-size: 1rem;
213239
font-weight: 600;
214240
cursor: pointer;
241+
transition: all 0.2s ease;
215242
}
216243

217244
.demo-btn:hover {
218-
opacity: 0.85;
245+
opacity: 0.9;
246+
transform: translateY(-1px);
247+
}
248+
249+
.demo-btn:active {
250+
transform: translateY(0);
219251
}
220252

221253
.demo-btn--outline {
@@ -225,22 +257,34 @@
225257
margin-top: 0.75rem;
226258
}
227259

260+
#demo-container {
261+
margin: 2rem 0;
262+
padding: 1.5rem;
263+
background: var(--sl-color-bg);
264+
border: 1px solid var(--sl-color-gray-5);
265+
border-radius: 0.5rem;
266+
min-height: 200px;
267+
}
268+
228269
.demo-output {
229-
margin-top: 1.5rem;
270+
margin-top: 2rem;
230271
}
231272

232273
.demo-output-label {
233-
font-size: 0.9rem;
274+
font-size: 1rem;
275+
font-weight: 600;
234276
color: var(--sl-color-text);
235-
margin-bottom: 0.5rem;
277+
margin-bottom: 0.75rem;
236278
}
237279

238280
#demo-code {
239281
background: var(--sl-color-bg-sidebar);
240282
border: 1px solid var(--sl-color-gray-5);
241-
border-radius: 0.25rem;
242-
padding: 1rem;
283+
border-radius: 0.5rem;
284+
padding: 1.25rem;
243285
overflow-x: auto;
244-
font-size: 0.85rem;
286+
font-size: 0.9rem;
287+
font-family: var(--__sl-font-mono);
288+
line-height: 1.6;
245289
}
246290
</style>

0 commit comments

Comments
 (0)