Skip to content

Commit 3aff99e

Browse files
docs: rounding tool
1 parent 6593ba6 commit 3aff99e

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

.storybook/addon-theme/register.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ enum TINT {
4242
SAND = "sand",
4343
}
4444
enum ROUNDING {
45-
MINIMAL = "minimal",
45+
SMALL = "sm",
4646
NORMAL = "normal",
47+
MEDIUM = "md",
4748
FULL = "full",
4849
}
4950

@@ -316,13 +317,13 @@ export const ThemeToggle = () => {
316317
/>
317318

318319
<IconButton
319-
title="Rounding: Minimal"
320-
active={rounding === ROUNDING.MINIMAL}
321-
onClick={() => changeRounding(ROUNDING.MINIMAL)}
320+
title="Rounding: Small"
321+
active={rounding === ROUNDING.SMALL}
322+
onClick={() => changeRounding(ROUNDING.SMALL)}
322323
>
323324
<div
324325
style={{
325-
width: "1rem",
326+
width: "1.5rem",
326327
height: "1rem",
327328
borderRadius: "2px",
328329
backgroundColor: "gray",
@@ -337,22 +338,37 @@ export const ThemeToggle = () => {
337338
>
338339
<div
339340
style={{
340-
width: "1rem",
341+
width: "1.5rem",
341342
height: "1rem",
342343
borderRadius: "4px",
343344
backgroundColor: "gray",
344345
}}
345346
/>
346347
</IconButton>
347348

349+
<IconButton
350+
title="Rounding: Medium"
351+
active={rounding === ROUNDING.MEDIUM}
352+
onClick={() => changeRounding(ROUNDING.MEDIUM)}
353+
>
354+
<div
355+
style={{
356+
width: "1.5rem",
357+
height: "1rem",
358+
borderRadius: "6px",
359+
backgroundColor: "gray",
360+
}}
361+
/>
362+
</IconButton>
363+
348364
<IconButton
349365
title="Rounding: Full"
350366
active={rounding === ROUNDING.FULL}
351367
onClick={() => changeRounding(ROUNDING.FULL)}
352368
>
353369
<div
354370
style={{
355-
width: "1rem",
371+
width: "1.5rem",
356372
height: "1rem",
357373
borderRadius: "8px",
358374
backgroundColor: "gray",

.storybook/preview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export default {
147147
const [globals] = useGlobals();
148148

149149
useEffect(() => {
150+
const scheme = localStorage.getItem("storybook-scheme") ?? "light";
150151
const theme = localStorage.getItem("storybook-theme") ?? "denim:jade";
151152
const tint = localStorage.getItem("storybook-tint") ?? "silver";
152153
const round = localStorage.getItem("storybook-rounding") ?? "normal";
@@ -163,6 +164,7 @@ export default {
163164
"--ruf-tint",
164165
`var(--${tint})`,
165166
);
167+
document.documentElement.dataset.colorScheme = scheme;
166168
document.documentElement.dataset.rounding = round;
167169
}, []);
168170

packages/core/css/reset/_theme.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@
8686
background-color: color-mix(in lab, var(--ruf-bg) 92%, var(--ruf-tint));
8787
}
8888

89-
[data-rounding="minimal"] {
89+
[data-rounding="sm"] {
9090
/* default rounding */
9191
--ruf-rounding: 2px;
9292
--ruf-rounding-cap: 2px;
9393
}
9494

95-
[data-rounding="normal"] {
95+
[data-rounding="md"] {
9696
/* default rounding */
9797
--ruf-rounding: 0.5rem;
9898
--ruf-rounding-cap: 0.5rem;

0 commit comments

Comments
 (0)