Skip to content

Commit

Permalink
add state to example slider
Browse files Browse the repository at this point in the history
  • Loading branch information
veej committed Oct 2, 2023
1 parent db2728d commit a802cbe
Showing 1 changed file with 40 additions and 31 deletions.
71 changes: 40 additions & 31 deletions packages/configuration-builder/src/TokensSection/BrandTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,51 @@ import { ColorSelector } from "./ColorSelector";
import { useTranslation } from "react-i18next";
import { Playground } from "./Playground";
import { ThemeConfig } from "../ConfiguratorStatusContext";
import { useState } from "react";

type Props = {
tokens: ThemeConfig["tokens"]["brandColor"];
onChange: (value: ThemeConfig["tokens"]["brandColor"]) => void;
};

function BrandTokensPlayground() {
const [slider, setSlider] = useState(50);
const { t } = useTranslation();
return (
<Playground>
<Stack space={40}>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.decorativeDivider")}
</Body>
<DecorativeDivider />
</Stack>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.areaLoader")}
</Body>
<Box position="relative" style={{ height: 240 }}>
<AreaLoader />
</Box>
</Stack>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.sliderField")}
</Body>
<SliderField
type="single"
label={unsafeLocalizedString("")}
value={slider}
minValue={0}
maxValue={100}
onChange={setSlider}
/>
</Stack>
</Stack>
</Playground>
);
}

export function BrandTokens(props: Props) {
const { t } = useTranslation();

Expand Down Expand Up @@ -56,37 +95,7 @@ export function BrandTokens(props: Props) {
/>
</Stack>
</Column>
<Playground>
<Stack space={40}>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.decorativeDivider")}
</Body>
<DecorativeDivider />
</Stack>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.areaLoader")}
</Body>
<Box position="relative" style={{ height: 240 }}>
<AreaLoader />
</Box>
</Stack>
<Stack space={12}>
<Body size="medium" color="secondary">
{t("Component.sliderField")}
</Body>
<SliderField
type="single"
label={unsafeLocalizedString("")}
value={50}
minValue={0}
maxValue={100}
onChange={() => {}}
/>
</Stack>
</Stack>
</Playground>
<BrandTokensPlayground />
</Columns>
</Stack>
);
Expand Down

0 comments on commit a802cbe

Please sign in to comment.