Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Button add tokens #47075

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions components/button/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,14 @@ const genDefaultButtonStyle: GenerateStyle<ButtonToken, CSSObject> = (token) =>
...genHoverActiveButtonStyle(
token.componentCls,
{
color: token.colorPrimaryHover,
borderColor: token.colorPrimaryHover,
color: token.defaultColorHover,
borderColor: token.defaultColorHover,
background: token.defaultBgHover,
},
{
color: token.colorPrimaryActive,
borderColor: token.colorPrimaryActive,
color: token.defaultColorActive,
borderColor: token.defaultBorderColorActive,
background: token.defaultBgActive,
},
),

Expand Down
42 changes: 42 additions & 0 deletions components/button/style/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ export interface ComponentToken {
* @descEN Text color of danger button
*/
dangerColor: string;
/**
* @desc 默认按钮悬浮态背景色
* @descEN Background color of default button when hover
*/
defaultBgHover: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 默认按钮悬浮态文本颜色
* @descEN Text color of default button when hover
*/
defaultColorHover: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 默认按钮悬浮态边框颜色
* @descEN Border color of default button
*/
defaultBorderColorHover: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 默认按钮激活态背景色
* @descEN Background color of default button when active
*/
defaultBgActive: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 默认按钮激活态边框颜色
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
* @descEN Text color of default button when active
*/
defaultColorActive: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 默认按钮激活态边框颜色
* @descEN Border color of default button when active
*/
defaultBorderColorActive: string;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
/**
* @desc 禁用状态边框颜色
* @descEN Border color of disabled button
Expand Down Expand Up @@ -189,6 +219,12 @@ export const prepareComponentToken: GetDefaultToken<'Button'> = (token) => {
const contentLineHeight = token.contentLineHeight ?? getLineHeight(contentFontSize);
const contentLineHeightSM = token.contentLineHeightSM ?? getLineHeight(contentFontSizeSM);
const contentLineHeightLG = token.contentLineHeightLG ?? getLineHeight(contentFontSizeLG);
const defaultBgHover = token.defaultBgHover ?? token.colorBgContainer;
const defaultColorHover = token.defaultColorHover ?? token.colorPrimaryHover;
const defaultBorderColorHover = token.defaultBorderColorHover ?? defaultColorHover;
const defaultBgActive = token.defaultBgActive ?? token.colorBgContainer;
const defaultColorActive = token.defaultColorActive ?? token.colorPrimaryActive;
const defaultBorderColorActive = token.defaultBorderColorActive ?? token.colorPrimaryActive;
MadCcc marked this conversation as resolved.
Show resolved Hide resolved

return {
fontWeight: 400,
Expand All @@ -214,6 +250,12 @@ export const prepareComponentToken: GetDefaultToken<'Button'> = (token) => {
defaultBg: token.colorBgContainer,
defaultBorderColor: token.colorBorder,
defaultBorderColorDisabled: token.colorBorder,
defaultBgHover,
defaultColorHover,
defaultBorderColorHover,
defaultBgActive,
defaultColorActive,
defaultBorderColorActive,
MadCcc marked this conversation as resolved.
Show resolved Hide resolved
contentFontSize,
contentFontSizeSM,
contentFontSizeLG,
Expand Down