File: D:/HostingSpaces/SBogers10/kommabasic.nl/resources/sass/5-Components/_components.button.scss
// Component settings: Button
// ------------------------------------------
$c-button: (
'color': palette(neutral, 0),
'bgcolor': palette(secondary),
'bgcolor-hover': scale-color(palette(secondary), $lightness: -20%),
);
// ------------------------------------------
.c-button {
@include border-radius(m);
@include font-size(xs);
font-weight: 500;
display: inline-flex;
align-items: center;
justify-content: center;
color: map-get($c-button, 'color');
background-color: map-get($c-button, 'bgcolor');
text-shadow: 0 0 4px rgba(0,0,0,0.2);
border: none;
padding: space(2) 0;
text-transform: uppercase;
position: relative;
overflow: hidden;
cursor: pointer;
text-decoration: none;
&:focus {
outline: none;
box-shadow: 0 0 0 1px palette(neutral, 0), 0 0 5px 2px map-get($c-button, 'bgcolor');
}
&:active:not(:disabled) {
outline: none;
box-shadow: none;
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
// Pseudo element for animating hover
&::after {
content: "";
position: absolute;
z-index: 1;
top: calc(50% - 2px);
left: calc(50% - 2px);
width: 4px;
height: 4px;
opacity: 0;
border-radius: 50%;
background: map-get($c-button, 'bgcolor-hover');
pointer-events: none;
transition-property: opacity, transform;
transition-duration: 0.5s;
}
&:hover:not(:disabled)::after {
opacity: 1;
transform: scale(100);
}
}
.c-button__text {
position: relative;
z-index: 2;
padding: 0 space(3);
text-align: center;
.c-button--icon & {
padding-right: space(2);
}
}
.c-button__icon {
display: none; // By default icon is hidden
position: relative;
z-index: 2;
top: -1px;
margin-right: 15px;
transition: transform 0.3s;
.c-button:hover:not(:disabled) & {
transform: translateX(3px);
}
// When icon comes before the text (in the DOM) switch the margin
&:first-child {
margin-right: 0;
margin-left: 15px;
}
.c-button--icon & {
display: block; // Show when has icon modifier
width: 16px;
}
}