This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FocusTrap } from './focus-trap.js'; | |
// Select a menu and its toggle button | |
const menuToggle = document.getElementById('menu-toggle'); | |
const menu = document.getElementById('menu'); | |
// Create a new FocusTrap instance on the menu | |
const focusTrap = new FocusTrap(menu); | |
// Prepend the menu toggle button to the focusable elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// These are the mixins | |
@mixin grid-layout($column-count, $column-gap: 3rem, $row-gap: null) { | |
$row-gap: if($row-gap == null, $column-gap, $row-gap); | |
display: grid; | |
grid-template-columns: repeat($column-count, 1fr); | |
grid-gap: $row-gap $column-gap; | |
gap: $row-gap $column-gap; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In order for these functions to work, the target element needs a transition CSS property to be set. | |
function slideUp(element, callback) { | |
element.style.overflow = 'hidden'; | |
element.style.height = element.clientHeight + 'px'; | |
setTimeout(() => { | |
element.style.height = 0; | |
}, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.findFirst = HTMLElement.prototype.findFirst = function(selector) { | |
return this.querySelector(selector); | |
} | |
document.findAll = HTMLElement.prototype.findAll = function(selector) { | |
return [...this.querySelectorAll(selector)]; | |
} | |
window.findFirst = document.findFirst.bind(document); | |
window.findAll = document.findAll.bind(document); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$columns: 12; | |
$gap: 30px; | |
$breakpoints: ( | |
xs: 480px, | |
sm: 768px, | |
md: 960px, | |
lg: 1170px, | |
xl: 1280px | |
); |