Skip to content

Commit

Permalink
Merge pull request #6133 from nanasess/fix-button-variant
Browse files Browse the repository at this point in the history
Bootstrap のバージョンアップに伴うデザイン修正
  • Loading branch information
ji-eunsoo authored Apr 12, 2024
2 parents ebec3e1 + adecb27 commit 8776cf0
Show file tree
Hide file tree
Showing 8 changed files with 349 additions and 147 deletions.
2 changes: 1 addition & 1 deletion html/template/admin/assets/css/app.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/template/admin/assets/css/app.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/template/admin/assets/css/app.min.css.map

Large diffs are not rendered by default.

410 changes: 270 additions & 140 deletions html/template/default/assets/css/style.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/template/default/assets/css/style.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/template/default/assets/css/style.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion html/template/default/assets/css/style.min.css.map

Large diffs are not rendered by default.

74 changes: 73 additions & 1 deletion html/template/default/assets/scss/mixins/_btn.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,78 @@ $btn-default-border: #ccc !default;
$btn-border-radius-base: 0px;
$cursor-disabled: not-allowed !default;

// Bootstrap 5.2 から CSS variables に変更されたため、Bootstrap 5.1.3 の button-variant を移植することで互換性を維持
// see https://getbootstrap.com/docs/5.3/migration/#more-css-variables
// see https://github.com/twbs/bootstrap/blob/1a6fdfae6be09b09eaced8f0e442ca6f7680a61e/scss/mixins/_buttons.scss#L7-L74
@mixin button-variant-compat(
$background,
$border,
$color: color-contrast($background),
$hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
$hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
$hover-color: color-contrast($hover-background),
$active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
$active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
$active-color: color-contrast($active-background),
$disabled-background: $background,
$disabled-border: $border,
$disabled-color: color-contrast($disabled-background)
) {
color: $color;
@include gradient-bg($background);
border-color: $border;
@include box-shadow($btn-box-shadow);

&:hover {
color: $hover-color;
@include gradient-bg($hover-background);
border-color: $hover-border;
}

.btn-check:focus + &,
&:focus {
color: $hover-color;
@include gradient-bg($hover-background);
border-color: $hover-border;
@if $enable-shadows {
@include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
} @else {
// Avoid using mixin so we can pass custom focus shadow properly
box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
}
}

.btn-check:checked + &,
.btn-check:active + &,
&:active,
&.active,
.show > &.dropdown-toggle {
color: $active-color;
background-color: $active-background;
// Remove CSS gradients if they're enabled
background-image: if($enable-gradients, none, null);
border-color: $active-border;

&:focus {
@if $enable-shadows {
@include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
} @else {
// Avoid using mixin so we can pass custom focus shadow properly
box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
}
}
}

&:disabled,
&.disabled {
color: $disabled-color;
background-color: $disabled-background;
// Remove CSS gradients if they're enabled
background-image: if($enable-gradients, none, null);
border-color: $disabled-border;
}
}

@mixin _btn($color, $background, $border){
display: inline-block;
margin-bottom: 0; // For input.btn
Expand Down Expand Up @@ -62,7 +134,7 @@ $cursor-disabled: not-allowed !default;
@include box-shadow(none);
}

@include button-variant($background, $border, $color, $disabled-color: $color);
@include button-variant-compat($background, $border, $color, $disabled-color: $color);
// [converter] extracted a& to a.btn

.ec-icon img {
Expand Down

0 comments on commit 8776cf0

Please sign in to comment.