Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/examples/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useToken } from './theme';

interface ButtonToken extends DerivativeToken {
buttonPadding: string;
buttonBorderBottomWidth: string;
}

// 通用框架
Expand Down Expand Up @@ -62,6 +63,7 @@ const genDefaultButtonStyle = (
genSolidButtonStyle(prefixCls, token, () => ({
backgroundColor: token.componentBackgroundColor,
color: token.textColor,
borderWidth: token.buttonBorderBottomWidth,

'&:hover': {
borderColor: token.primaryColor,
Expand Down Expand Up @@ -137,6 +139,7 @@ const Button = ({ className, type, ...restProps }: ButtonProps) => {
},
() => ({
buttonPadding: '4px 8px',
buttonBorderBottomWidth: `calc(${token.borderWidth} * 2)`,
}),
);

Expand Down
6 changes: 4 additions & 2 deletions docs/examples/css-var.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const Demo = () => (

export default function App() {
const [show, setShow] = React.useState(true);

const [, forceUpdate] = React.useState({});
const [color, setColor] = React.useState('royalblue');
React.useEffect(() => {
forceUpdate({});
}, []);
Expand All @@ -30,13 +30,15 @@ export default function App() {
Show Components
</label>

<button onClick={() => { setColor((prev) => prev === 'royalblue' ? 'mediumslateblue' : 'royalblue')}}>Change theme</button>

{show && (
<div>
<Demo />
<br />
<DesignTokenProvider
value={{
token: { primaryColor: 'green' },
token: { primaryColor: color },
}}
>
<Demo />
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCacheToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default function useCacheToken<
) as [any, string];
tokenWithCssVar._hashId = hashId;

recordCleanToken(hashId);
recordCleanToken(cssVar.key);
return [tokenWithCssVar, hashCls, actualToken, cssVarsStr, cssVar.key];
},
([, , , , themeKey]) => {
Expand Down