mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
fix(Button): text variant tokens not working (#56291)
* fix(Button): text variant tokens not working * test(Button): add debug demo for text variant component tokens * test: update button debug color variant snapshots * fix: getCssVar to varName --------- Co-authored-by: 遇见同学 <1875694521@qq.com> Co-authored-by: thinkasany <480968828@qq.com>
This commit is contained in:
@@ -968,6 +968,18 @@ exports[`renders components/button/demo/debug-color-variant.tsx extend context c
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-flex css-var-test-id ant-flex-wrap-wrap ant-flex-gap-small"
|
||||
>
|
||||
<button
|
||||
class="ant-btn css-var-test-id ant-btn-text ant-btn-color-default ant-btn-variant-text"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
type="text" (Default)
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
@@ -952,6 +952,18 @@ exports[`renders components/button/demo/debug-color-variant.tsx correctly 1`] =
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-flex css-var-test-id ant-flex-wrap-wrap ant-flex-gap-small"
|
||||
>
|
||||
<button
|
||||
class="ant-btn css-var-test-id ant-btn-text ant-btn-color-default ant-btn-variant-text"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
type="text" (Default)
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
||||
@@ -114,6 +114,22 @@ const App: React.FC = () => {
|
||||
<Button type="dashed">Dashed</Button>
|
||||
</ConfigProvider>
|
||||
</Flex>
|
||||
<Flex gap="small" wrap>
|
||||
<ConfigProvider
|
||||
theme={{
|
||||
components: {
|
||||
Button: {
|
||||
textTextColor: '#f60',
|
||||
textTextHoverColor: '#722ed1',
|
||||
textTextActiveColor: '#0f0',
|
||||
textHoverBg: '#000',
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Button type="text">type="text" (Default)</Button>
|
||||
</ConfigProvider>
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -239,6 +239,13 @@ const genVariantStyle: GenerateStyle<ButtonToken> = (token) => {
|
||||
[varName('bg-color-active')]: token.defaultActiveBg,
|
||||
},
|
||||
|
||||
[`&${componentCls}-variant-text`]: {
|
||||
[varName('text-color')]: token.textTextColor,
|
||||
[varName('text-color-hover')]: token.textTextHoverColor,
|
||||
[varName('text-color-active')]: token.textTextActiveColor,
|
||||
[varName('bg-color-hover')]: token.textHoverBg,
|
||||
},
|
||||
|
||||
[`&${componentCls}-background-ghost`]: {
|
||||
[`&${componentCls}-variant-outlined, &${componentCls}-variant-dashed`]: {
|
||||
[varName('text-color')]: token.defaultGhostColor,
|
||||
|
||||
Reference in New Issue
Block a user