Zelda64Recomp/assets/scss/styles/components/IconButton.scss

92 lines
2.1 KiB
SCSS

@use 'sass:color';
/*
<button
class="icon-button icon-button--danger"
>
<svg src="icons/Trash.svg" />
</button>
*/
@mixin create-icon-button-variation($base-col) {
border-color: rgba($base-col, 0.8);
background-color: rgba($base-col, 0.05);
&:focus, &:hover {
border-color: $base-col;
background-color: rgba($base-col, 0.3);
}
&:active {
background-color: rgba($base-col, 0.2);
}
}
$icon-button-size: 56 - ($border-width-thickness-num * 2);
.icon-button {
@include set-color($color-text-dim);
@include trans-colors-border;
display: flex;
align-items: center;
justify-content: center;
width: space($icon-button-size);
min-width: space($icon-button-size);
max-width: space($icon-button-size);
height: space($icon-button-size);
min-height: space($icon-button-size);
max-height: space($icon-button-size);
border-width: $border-width-thickness;
border-radius: space($icon-button-size * 0.5);
border-color: $color-transparent;
background-color: $color-transparent;
&:focus, &:hover {
@include set-color($color-text);
background-color: $color-border;
}
&:active {
@include set-color(color.scale($color-text, $lightness: 20%));
background-color: $color-border-soft;
}
&:disabled,&[disabled] {
@include set-color($color-text-dim);
opacity: 0.5;
}
&:not([disabled]) {
@extend %nav-all;
cursor: pointer;
}
svg {
width: space(32);
height: space(32);
}
&--primary {
@include create-icon-button-variation($color-primary);
}
&--secondary {
@include create-icon-button-variation($color-secondary);
}
&--tertiary {
@include create-icon-button-variation($color-text);
}
&--success {
@include create-icon-button-variation($color-success);
}
&--danger {
@include create-icon-button-variation($color-error);
}
&--warning {
@include create-icon-button-variation($color-warning);
}
}