Skip to content

Commit

Permalink
feat: add button disable token
Browse files Browse the repository at this point in the history
  • Loading branch information
DaiQiangReal committed Nov 10, 2023
1 parent a517205 commit 34ac893
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
35 changes: 30 additions & 5 deletions packages/semi-foundation/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ $module: #{$prefix}-button;
border $transition_duration-button_danger-border $transition_function-button_danger-border $transition_delay-button_danger-border;
transform: scale($transform-scale-button_danger);

&-disabled{
background-color: $color-button_disabled-bg-danger;
&.#{$module}-light{
background-color: $color-button_disabled_light-bg-danger;
}
}

&:hover {
background-color: $color-button_danger-bg-hover;
Expand All @@ -64,7 +70,12 @@ $module: #{$prefix}-button;
transition: background-color $transition_duration-button_warning-bg $transition_function-button_warning-bg $transition_delay-button_warning-bg,
border $transition_duration-button_warning-border $transition_function-button_warning-border $transition_delay-button_warning-border;
transform:scale($transform_scale-button_warning);

&-disabled{
background-color: $color-button_disabled-bg-warning;
&.#{$module}-light{
background-color: $color-button_disabled_light-bg-warning;
}
}
&:hover {
background-color: $color-button_warning-bg-hover;
}
Expand All @@ -85,7 +96,12 @@ $module: #{$prefix}-button;
transition: background-color $transition_duration-button_tertiary-bg $transition_function-button_tertiary-bg $transition_delay-button_tertiary-bg,
border $transition_duration-button_tertiary-border $transition_function-button_tertiary-border $transition_delay-button_tertiary-border;
transform:scale($transform_scale_button_tertiary);

&-disabled{
background-color: $color-button_disabled-bg-tertiary;
&.#{$module}-light{
background-color: $color-button_disabled_light-bg-tertiary;
}
}
&:hover {
background-color: $color-button_tertiary-bg-hover;
}
Expand All @@ -103,7 +119,12 @@ $module: #{$prefix}-button;
transition: background-color $transition_duration-button_primary-bg $transition_function-button_primary-bg $transition_delay-button_primary-bg,
border $transition_duration-button_primary-border $transition_function-button_primary-border $transition_delay-button_primary-border;;
transform:scale($transform_scale-button_primary);

&-disabled{
background-color: $color-button_disabled-bg-primary;
&.#{$module}-light{
background: $color-button_disabled_light-bg-primary;
}
}
&:not(.#{$module}-borderless):not(.#{$module}-light):hover {
background-color: $color-button_primary-bg-hover;
}
Expand All @@ -123,6 +144,12 @@ $module: #{$prefix}-button;
transition: background-color $transition_duration-button_secondary-bg $transition_function-button_secondary-bg $transition_delay-button_secondary-bg,
border $transition_duration-button_secondary-border $transition_function-button_secondary-border $transition_delay-button_secondary-border;
transform:scale($transform_scale-button_secondary);
&-disabled{
background-color: $color-button_disabled-bg-secondary;
&.#{$module}-light{
background-color: $color-button_disabled_light-bg-secondary;
}
}

&:hover {
background-color: $color-button_secondary-bg-hover;
Expand All @@ -138,10 +165,8 @@ $module: #{$prefix}-button;
}
&-disabled {
color: $color-button_disabled_solid-text-default;
background-color: $color-button_disabled-bg-default;
&:not(.#{$module}-borderless):not(.#{$module}-light):hover {
color: $color-button_disabled-text-hover;
background-color: $color-button_disabled-bg-hover;
}
cursor: not-allowed;

Expand Down
13 changes: 13 additions & 0 deletions packages/semi-foundation/button/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ $color-button_disabled-text-default: var(--semi-color-disabled-text); // ็ฆ็”จ
$color-button_disabled-bg-default: var(--semi-color-disabled-bg); // ็ฆ็”จๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled-text-hover: $color-button_disabled-text-default; // ็ฆ็”จๆŒ‰้’ฎๆ–‡ๅญ—้ขœ่‰ฒ - ๆ‚ฌๆตฎ
$color-button_disabled-bg-hover: var(--semi-color-disabled-bg); // ็ฆ็”จๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ - ๆ‚ฌๆตฎ
$color-button_disabled-bg-primary: $color-button_disabled-bg-default; // ็ฆ็”จ primary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled-bg-secondary: $color-button_disabled-bg-default; // ็ฆ็”จ secondary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled-bg-danger: $color-button_disabled-bg-default; // ็ฆ็”จ danger ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled-bg-warning: $color-button_disabled-bg-default; // ็ฆ็”จ warning ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled-bg-tertiary: $color-button_disabled-bg-default; // ็ฆ็”จ tertiary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ



// light
$color-button_light-bg-default: var(--semi-color-fill-0); // ๆต…่‰ฒๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
Expand All @@ -92,6 +99,12 @@ $color-button_light-border-hover: $color-button_light-border-default; // ๆต…่‰ฒ
$color-button_light-border-active: $color-button_light-border-hover; // ๆต…่‰ฒๆŒ‰้’ฎๆ่พน้ขœ่‰ฒ - ๆŒ‰ไธ‹
$width-button_light-border: 0; // ๆต…่‰ฒๆŒ‰้’ฎๆ่พนๅฎฝๅบฆ

$color-button_disabled_light-bg-primary: $color-button_light-bg-default; // ็ฆ็”จ light primary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled_light-bg-secondary: $color-button_light-bg-default; // ็ฆ็”จ light secondary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled_light-bg-danger: $color-button_light-bg-default; // ็ฆ็”จ light danger ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled_light-bg-warning: $color-button_light-bg-default; // ็ฆ็”จ light warning ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_disabled_light-bg-tertiary: $color-button_light-bg-default; // ็ฆ็”จ light tertiary ๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ

// borderless
$color-button_borderless-text-default: var(--semi-color-primary); // ๆ— ่ƒŒๆ™ฏๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ
$color-button_borderless-bg-hover: var(--semi-color-fill-0); // ๆ— ่ƒŒๆ™ฏๆŒ‰้’ฎ่ƒŒๆ™ฏ้ขœ่‰ฒ - ๆ‚ฌๆตฎ
Expand Down
1 change: 1 addition & 0 deletions packages/semi-ui/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default class Button extends PureComponent<ButtonProps> {
[`${prefixCls}-block`]: block,
[`${prefixCls}-circle`]: circle,
[`${prefixCls}-borderless`]: theme === 'borderless',
[`${prefixCls}-${type}-disabled`]: disabled && type,
},
className
),
Expand Down

0 comments on commit 34ac893

Please sign in to comment.