File: D:/HostingSpaces/SBogers10/switch4u.komma.nl/resources/sass/5-Components/_components.hero.scss
// Component settings: Hero
// ------------------------------------------
$c-hero: (
'caption-bgcolor': palette(neutral, 900),
'caption-color': palette(neutral, 0),
);
// ------------------------------------------
.c-hero {
@include mq(m) {
@include contain;
}
}
.c-hero__main {
position: relative;
background-color: palette(neutral, 0);
}
.c-hero__slider {
overflow: hidden;
position: relative;
padding-bottom: 55.556%; // Ratio used for mobile image
@include mq(m, l) {
padding-bottom: 50%; // Ratio used for image
}
}
.c-hero__picture {
position: absolute;
top: 0;
left: 0;
opacity: 0;
transition-property: opacity, filter;
transition-duration: 500ms;
transition-timing-function: linear;
filter: blur(5px);
&.is-active {
opacity: 1;
transform: translateY(0) scale(1);
filter: none;
}
}
.c-hero__image {
width: 100%;
}
.c-hero__caption {
//@include hyphenate;
font-size: calc(16px + 1vw);
font-weight: bold;
position: relative;
padding: space(3);
line-height: 1.2;
text-align: center;
color: map-get($c-hero, 'caption-color');
background-color: map-get($c-hero, 'caption-bgcolor');
@include mq(m) {
position: absolute;
bottom: 0;
max-width: column(6,12);
padding: space(4);
text-align: left;
}
// Font-lock to scale font-size proportionally
@include mq(m, l) {
padding: 2.6vw; // Magic value so text scales nicely
font-size: 3.5vw; // Magic value so text scales nicely
line-height: 1.15;
}
@include mq(l) {
@include font-size(xxxl);
line-height: 1.25;
padding-left: column(0.5);
}
}
.c-hero__controls {
position: absolute;
bottom: 0;
right: 0;
width: 100%;
padding: space(1);
&::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
height: space(6);
width: 100%;
background: linear-gradient(to top, black, transparent);
opacity: 0.3;
}
}
// Button with arrow that scrolls down
.c-hero__scroll {
@include mq($max: m) {
display: none;
}
display: flex;
justify-content: center;
align-items: center;
position: absolute;
bottom: 0;
left: 50%;
width: 40px;
height: 40px;
padding: 10px;
color: palette(neutral, 0);
background-color: palette(secondary);
border-radius: 100%;
transform: translate(-50%, 50%) rotate(0.25turn);
transition: background-color 200ms;
& > svg {
transition: transform 200ms;
}
&:hover {
cursor: pointer;
background: scale_color(palette(secondary), $lightness: -15%);
& > svg {
transform: translateX(3px);
}
}
&:focus {
outline: none;
background: scale_color(palette(secondary), $lightness: -10%);
box-shadow: 0 0 0 3px scale_color(palette(secondary), $lightness: 70%);
}
}