Skip to content

Commit 3f59ff9

Browse files
committed
chore: change configs
1 parent 2d4533a commit 3f59ff9

File tree

6 files changed

+164
-110
lines changed

6 files changed

+164
-110
lines changed

apps/docs/src/content/generator/Colors.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useGeneratorContext } from "./GeneratorContext";
1212

1313
const colorsToDisplay = [
1414
"bgPage",
15+
"bgContainer",
1516
"positive",
1617
"negative",
1718
"warning",

apps/docs/src/content/generator/Dialogs/ColorsConfig.tsx

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
HvDialogContent,
1010
HvDialogTitle,
1111
HvTypography,
12+
useTheme,
1213
} from "@hitachivantara/uikit-react-core";
1314

1415
import { useGeneratorContext } from "../GeneratorContext";
@@ -24,6 +25,7 @@ export const ColorsConfig = ({
2425
Record<string, string>
2526
>({});
2627

28+
const { activeTheme } = useTheme();
2729
const { customTheme, updateCustomTheme, colorMode } = useGeneratorContext();
2830

2931
const handleSave = useCallback(() => {
@@ -37,24 +39,27 @@ export const ColorsConfig = ({
3739
},
3840
});
3941
setOpen(false);
40-
}, [
41-
localColorValues,
42-
// customTheme.colors,
43-
updateCustomTheme,
44-
setOpen,
45-
colorMode,
46-
]);
42+
}, [localColorValues, updateCustomTheme, setOpen, colorMode]);
43+
44+
const handleReset = useCallback(() => {
45+
setlocalColorValues(activeTheme?.colors.modes[colorMode] || {});
46+
}, [activeTheme, colorMode]);
4747

4848
return (
4949
<HvDialog
5050
open={open}
5151
onClose={() => setOpen((p) => !p)}
52-
maxWidth="xs"
52+
maxWidth="md"
5353
fullWidth
5454
>
5555
<HvDialogTitle>Radius Settings</HvDialogTitle>
5656
<HvDialogContent>
57-
<div className="gap-[var(--uikit-space-xxs)]">
57+
<div
58+
className="grid grid-auto-flow-col grid-cols-2 gap-x-[var(--uikit-space-lg)] gap-y-0"
59+
style={{
60+
gridTemplateRows: `repeat(${Math.ceil(colorTokens.length / 2)}, auto)`,
61+
}}
62+
>
5863
{colorTokens.map((c) => (
5964
<div
6065
key={c}
@@ -77,6 +82,10 @@ export const ColorsConfig = ({
7782
</div>
7883
</HvDialogContent>
7984
<HvDialogActions>
85+
<HvButton variant="ghost" onClick={handleReset}>
86+
Reset to Defaults
87+
</HvButton>
88+
<div className="flex-1" />
8089
<HvButton variant="secondarySubtle" onClick={() => setOpen(false)}>
8190
Cancel
8291
</HvButton>
@@ -137,4 +146,16 @@ const colorTokens = [
137146
"bgPageSecondary",
138147
"bgContainerSecondary",
139148
"bgDisabled",
149+
"cat1",
150+
"cat2",
151+
"cat3",
152+
"cat4",
153+
"cat5",
154+
"cat6",
155+
"cat7",
156+
"cat8",
157+
"cat9",
158+
"cat10",
159+
"cat11",
160+
"cat12",
140161
];

apps/docs/src/content/generator/Dialogs/RadiiConfig.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
HvDialogTitle,
1010
HvInput,
1111
HvTypography,
12+
useTheme,
1213
} from "@hitachivantara/uikit-react-core";
1314

1415
import { useGeneratorContext } from "../GeneratorContext";
@@ -26,6 +27,7 @@ export const RadiiConfig = ({
2627
Record<string, string>
2728
>({});
2829

30+
const { activeTheme } = useTheme();
2931
const { customTheme, updateCustomTheme } = useGeneratorContext();
3032

3133
const handleSave = useCallback(() => {
@@ -37,6 +39,10 @@ export const RadiiConfig = ({
3739
setOpen(false);
3840
}, [localRadiiValues, updateCustomTheme, setOpen]);
3941

42+
const handleReset = useCallback(() => {
43+
setLocalRadiiValues(activeTheme?.radii || {});
44+
}, [activeTheme]);
45+
4046
return (
4147
<HvDialog
4248
open={open}
@@ -72,6 +78,10 @@ export const RadiiConfig = ({
7278
</div>
7379
</HvDialogContent>
7480
<HvDialogActions>
81+
<HvButton variant="ghost" onClick={handleReset}>
82+
Reset to Defaults
83+
</HvButton>
84+
<div className="flex-1" />
7585
<HvButton variant="secondarySubtle" onClick={() => setOpen(false)}>
7686
Cancel
7787
</HvButton>

apps/docs/src/content/generator/Dialogs/SpacingConfig.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
HvDialogTitle,
1010
HvInput,
1111
HvTypography,
12+
useTheme,
1213
} from "@hitachivantara/uikit-react-core";
1314

1415
import { useGeneratorContext } from "../GeneratorContext";
@@ -26,6 +27,7 @@ export const SpacingConfig = ({
2627
Record<string, string>
2728
>({});
2829

30+
const { activeTheme } = useTheme();
2931
const { customTheme, updateCustomTheme } = useGeneratorContext();
3032

3133
const handleSave = useCallback(() => {
@@ -37,6 +39,10 @@ export const SpacingConfig = ({
3739
setOpen(false);
3840
}, [localSpacingValues, updateCustomTheme, setOpen]);
3941

42+
const handleReset = useCallback(() => {
43+
setLocalSpacingValues(activeTheme?.space || {});
44+
}, [activeTheme]);
45+
4046
return (
4147
<HvDialog
4248
open={open}
@@ -72,6 +78,10 @@ export const SpacingConfig = ({
7278
</div>
7379
</HvDialogContent>
7480
<HvDialogActions>
81+
<HvButton variant="ghost" onClick={handleReset}>
82+
Reset to Defaults
83+
</HvButton>
84+
<div className="flex-1" />
7585
<HvButton variant="secondarySubtle" onClick={() => setOpen(false)}>
7686
Cancel
7787
</HvButton>

apps/docs/src/content/generator/Generator.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import { HvProvider } from "@hitachivantara/uikit-react-core";
4+
import { HvVizProvider } from "@hitachivantara/uikit-react-viz";
45

56
import { ActiveUsers } from "../../components/home/cards/ActiveUsers";
67
import { ApiUsage } from "../../components/home/cards/ApiUsage";
@@ -34,26 +35,28 @@ const GeneratorInternal = () => {
3435
rootElementId="generator-root"
3536
cssTheme="scoped"
3637
>
37-
<div className="flex-1 bg-bgPage border-border border-rounded-round">
38-
<div className="grid xs:grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-[var(--uikit-space-md)] p-md mx-auto">
39-
<div className="flex flex-col gap-[var(--uikit-space-md)]">
40-
<DataInsights />
41-
<Orders />
42-
<DataProcessing />
43-
</div>
44-
<div className="flex flex-col gap-[var(--uikit-space-md)]">
45-
<FinancialPerformance />
46-
<StorageOverview />
47-
<DataConfig />
48-
</div>
49-
<div className="flex flex-col gap-[var(--uikit-space-md)]">
50-
<ApiUsage />
51-
<DataSecurity />
52-
<TeamOverview />
53-
<ActiveUsers />
38+
<HvVizProvider>
39+
<div className="flex-1 bg-bgPage border-border border-rounded-round">
40+
<div className="grid xs:grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-[var(--uikit-space-md)] p-md mx-auto">
41+
<div className="flex flex-col gap-[var(--uikit-space-md)]">
42+
<DataInsights />
43+
<Orders />
44+
<DataProcessing />
45+
</div>
46+
<div className="flex flex-col gap-[var(--uikit-space-md)]">
47+
<FinancialPerformance />
48+
<StorageOverview />
49+
<DataConfig />
50+
</div>
51+
<div className="flex flex-col gap-[var(--uikit-space-md)]">
52+
<ApiUsage />
53+
<DataSecurity />
54+
<TeamOverview />
55+
<ActiveUsers />
56+
</div>
5457
</div>
5558
</div>
56-
</div>
59+
</HvVizProvider>
5760
</HvProvider>
5861
</div>
5962
</div>

0 commit comments

Comments
 (0)