Skip to content

Commit 5bd6395

Browse files
committed
add state to example slider
1 parent 89de08a commit 5bd6395

File tree

1 file changed

+40
-31
lines changed

1 file changed

+40
-31
lines changed

packages/configuration-builder/src/TokensSection/BrandTokens.tsx

+40-31
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,51 @@ import { ColorSelector } from "./ColorSelector";
1414
import { useTranslation } from "react-i18next";
1515
import { Playground } from "./Playground";
1616
import { ThemeConfig } from "../ConfiguratorStatusContext";
17+
import { useState } from "react";
1718

1819
type Props = {
1920
tokens: ThemeConfig["tokens"]["brandColor"];
2021
onChange: (value: ThemeConfig["tokens"]["brandColor"]) => void;
2122
};
2223

24+
function BrandTokensPlayground() {
25+
const [slider, setSlider] = useState(50);
26+
const { t } = useTranslation();
27+
return (
28+
<Playground>
29+
<Stack space={40}>
30+
<Stack space={12}>
31+
<Body size="medium" color="secondary">
32+
{t("Component.decorativeDivider")}
33+
</Body>
34+
<DecorativeDivider />
35+
</Stack>
36+
<Stack space={12}>
37+
<Body size="medium" color="secondary">
38+
{t("Component.areaLoader")}
39+
</Body>
40+
<Box position="relative" style={{ height: 240 }}>
41+
<AreaLoader />
42+
</Box>
43+
</Stack>
44+
<Stack space={12}>
45+
<Body size="medium" color="secondary">
46+
{t("Component.sliderField")}
47+
</Body>
48+
<SliderField
49+
type="single"
50+
label={unsafeLocalizedString("")}
51+
value={slider}
52+
minValue={0}
53+
maxValue={100}
54+
onChange={setSlider}
55+
/>
56+
</Stack>
57+
</Stack>
58+
</Playground>
59+
);
60+
}
61+
2362
export function BrandTokens(props: Props) {
2463
const { t } = useTranslation();
2564

@@ -56,37 +95,7 @@ export function BrandTokens(props: Props) {
5695
/>
5796
</Stack>
5897
</Column>
59-
<Playground>
60-
<Stack space={40}>
61-
<Stack space={12}>
62-
<Body size="medium" color="secondary">
63-
{t("Component.decorativeDivider")}
64-
</Body>
65-
<DecorativeDivider />
66-
</Stack>
67-
<Stack space={12}>
68-
<Body size="medium" color="secondary">
69-
{t("Component.areaLoader")}
70-
</Body>
71-
<Box position="relative" style={{ height: 240 }}>
72-
<AreaLoader />
73-
</Box>
74-
</Stack>
75-
<Stack space={12}>
76-
<Body size="medium" color="secondary">
77-
{t("Component.sliderField")}
78-
</Body>
79-
<SliderField
80-
type="single"
81-
label={unsafeLocalizedString("")}
82-
value={50}
83-
minValue={0}
84-
maxValue={100}
85-
onChange={() => {}}
86-
/>
87-
</Stack>
88-
</Stack>
89-
</Playground>
98+
<BrandTokensPlayground />
9099
</Columns>
91100
</Stack>
92101
);

0 commit comments

Comments
 (0)