Skip to content

Commit a2cc7bd

Browse files
authored
fix(ThemingParameters): update css vars (#6823)
1 parent 1e03dc4 commit a2cc7bd

File tree

4 files changed

+165
-6
lines changed

4 files changed

+165
-6
lines changed

docs/knowledgeBaseExamples/ThemeableThemingParameters.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { getTheme, setTheme } from '@ui5/webcomponents-base/dist/config/Theme.js';
2+
import { FlexBox, FlexBoxDirection, Label, Option, Panel, Select, Text, ThemeProvider } from '@ui5/webcomponents-react';
3+
import { ThemingParameters } from '@ui5/webcomponents-react-base';
24
import { useEffect, useReducer, useState } from 'react';
35
import type { CSSProperties } from 'react';
46
import { MAPPED_THEMES } from '../../.storybook/utils';
5-
import { FlexBox, FlexBoxDirection, Label, Option, Panel, Select, Text, ThemeProvider } from '@ui5/webcomponents-react';
6-
import { ThemingParameters } from '@ui5/webcomponents-react-base';
77

88
const containerStyles = {
99
display: 'grid',
@@ -14,6 +14,7 @@ const containerStyles = {
1414

1515
const FONTS = [];
1616
const COLORS = [];
17+
const SPACING = [];
1718
const OTHERS = Object.entries(ThemingParameters).filter(([key, value]) => {
1819
if (key.includes('Font')) {
1920
if (key.includes('FontUrl')) {
@@ -27,6 +28,16 @@ const OTHERS = Object.entries(ThemingParameters).filter(([key, value]) => {
2728
COLORS.push([key, value]);
2829
return false;
2930
}
31+
if (
32+
key.includes('Space') ||
33+
key.includes('Margin') ||
34+
key.includes('Padding') ||
35+
key.includes('Gap') ||
36+
key.includes('Breakpoint')
37+
) {
38+
SPACING.push([key, value]);
39+
return false;
40+
}
3041
return true;
3142
});
3243

@@ -37,7 +48,7 @@ const getStyleFonts = (val) => {
3748
} else if (val.includes('Size')) {
3849
style.fontSize = val;
3950
} else if (val.includes('Weight')) {
40-
style.fontWeight;
51+
style.fontWeight = val;
4152
}
4253
return style;
4354
};
@@ -161,6 +172,13 @@ export const ThemeableCSSVars = () => {
161172
})}
162173
</div>
163174
</Panel>
175+
<Panel headerText="Spacing" collapsed>
176+
<div style={containerStyles}>
177+
{SPACING.map(([key, value]) => {
178+
return <Variables key={key} varKey={key} value={value} theme={currentTheme} />;
179+
})}
180+
</div>
181+
</Panel>
164182
<Panel headerText="Others" collapsed>
165183
<div style={containerStyles}>
166184
{OTHERS.map(([key, value]) => {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"chromatic": "cross-env STORYBOOK_ENV=chromatic npx chromatic --build-script-name build:storybook",
3030
"postinstall": "husky && yarn setup",
3131
"create-cypress-commands-docs": "documentation build ./packages/cypress-commands/src/commands.ts -f json -o ./packages/cypress-commands/api-commands.json && documentation build ./packages/cypress-commands/src/queries.ts -f json -o ./packages/cypress-commands/api-queries.json",
32-
"sb:prepare-cem": "node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents --out ./.storybook/custom-element-manifests/main.json && node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents-fiori --out ./.storybook/custom-element-manifests/fiori.json"
32+
"sb:prepare-cem": "node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents --out ./.storybook/custom-element-manifests/main.json && node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents-fiori --out ./.storybook/custom-element-manifests/fiori.json",
33+
"create-theming-parameters": "node scripts/generate-theming-parameters.js"
3334
},
3435
"dependencies": {
3536
"@storybook/addon-a11y": "8.4.5",

0 commit comments

Comments
 (0)