geo-coop/web/themes/custom/geofresco/src/global/_layout.scss

195 lines
4.9 KiB
SCSS

@charset "UTF-8";
// Extend or override Bulma's layouts ../../node_modules/bulma/sass/layout
@use "variables" as local;
@use "../../node_modules/bulma/sass/utilities/mixins";
@use "../../node_modules/bulma/sass/utilities/initial-variables" as *;
// Allow sitename to slide over the logo on tiny screens.
@include mixins.until(local.$mini) {
.geo-logo-name .sitename {
position: absolute;
left: calc(100vw - 14rem);
top: 0;
}
// .logo.column {
// width: 100%;
// }
.navigation.column .hamburger {
position: absolute;
right: 0;
top: 0;
}
}
.search-bar {
padding-top: 1.75rem;
}
.search-bar > .block,
.logo > .image {
display: inline-block;
}
// Allow the primary page content to be flush with the bottom of the slogan.
.main-section {
padding-top: 0;
.group-header {
padding-top: 0;
}
}
// On certain node pages, drop the title over (where we want) the image (to be).
.page--content-item--article,
.page--content-item--blog,
.page--content-item--collection,
.page--content-item--people
{
.page-title {
height: 0;
position: relative;
overflow: visible;
z-index: 10;
}
}
// Prevent a slight horizontal scroll.
// On content listing pages (e.g. card view mode).
.background-replacement-for-no-image {
height: 10rem;
}
// On full content pages.
.featured-image .background-replacement-for-no-image {
height: 12rem;
@include mixins.from($desktop) {
height: 14rem;
}
@include mixins.from($widescreen) {
height: 16rem;
}
}
// Yes i know i should just give author bios their own class
.node--type-people.node--view-mode-teaser {
margin-bottom: 1rem;
}
// Main navigation, goes to code in page.html.twig
@include mixins.touch {
// Code adapted from https://unused-css.com/blog/css-only-hamburger-menu/
.hamburger-container {
transition: transform 0.5s ease;
}
// We don't need the checkbox to be visible, but we can't set it to display: none because this will break keyboard navigation. Instead set the opacity to 0 and the position to absolute so it doesn't push the rest of the content down.
.hamburger-container .checkbox {
opacity: 0;
position: absolute;
}
// Show an outline when the hamburger is selected using the keyboard. Older browsers don't support :focus-visible, so we will just use :focus here.
.hamburger-container .checkbox:focus ~ .hamburger {
outline: 2px solid yellow; // Default for browsers that do not support outline: auto
outline: auto;
outline-offset: 4px;
}
// For newer browsers that do support :focus-visible, hide the outline when the checkbox isn't selected with the keyboard.
@supports selector(:focus-visible) {
.hamburger-container .checkbox:not(:focus-visible) ~ .hamburger {
outline: none;
}
}
// Hide any focusable elements in the drawer by default to aid keyboard navigation. We use visibility so it makes the elements unfocusable, but doesn't affect the layout. We can also add a "transition" to visibility, which will make it show instantly when we open the drawer, but take half a second to hide it when we close the drawer.
.hamburger-container .drawer {
visibility: hidden;
transition: visibility 0.5s linear;
}
// Make the focusable elements in the drawer visible when it is open.
.hamburger-container .checkbox:checked ~ .drawer {
visibility: visible;
}
.hamburger-container .checkbox:checked ~ .drawer {
transform: translateX(0%);
}
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(1) {
transform: translateY(0.6875rem) rotate(45deg);
}
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(2) {
opacity: 0;
}
.hamburger-container .checkbox:checked ~ .hamburger .slice:nth-child(3) {
transform: translateY(-0.6875rem) rotate(-45deg);
}
.hamburger {
cursor: pointer;
display: block;
position: relative;
margin-left: auto;
margin-right: 0;
padding: 1.5rem 2rem 1rem 1rem;
width: 5rem;
height: 5rem;
transition: transform 0.3s ease;
z-index: 1;
}
.hamburger .slice {
display: block;
width: 100%;
height: 0.1875rem;
background-color: $green;
transition: all 0.3s ease;
}
.hamburger .slice:not(:first-child) {
margin-top: 0.5rem;
}
.drawer {
position: absolute;
right: 0;
top: 5rem;
height: fit-content;
width: max-content;
max-width: 100%;
padding: 1.5rem;
background: local.$offwhite;
transform: translateX(-100%);
transition: transform 0.4s ease;
z-index: 10001;
}
.drawer .nav-list {
padding: 0;
list-style: none;
// margin-top: 30px;
// margin-left: 20px;
}
.drawer .nav-list .nav-list-item {
// padding-bottom: 10px;
}
}
@include mixins.desktop {
.hamburger, #hamburger-toggle {
display: none;
}
}
// Make the drawer full-width on mobile
@include mixins.mobile {
.drawer {
width: 100%;
}
}