This file contains 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 React, { useEffect, useImperativeHandle, useState, forwardRef, useCallback } from 'react' | |
import { createPortal } from 'react-dom' | |
import './styles.css' | |
const modalElement = document.getElementById('modal-root') | |
export function Modal({ children, fade = false, defaultOpened = false }, ref) { | |
const [isOpen, setIsOpen] = useState(defaultOpened) | |
const close = useCallback(() => setIsOpen(false), []) |
This file contains 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
.ellipsis { | |
position: relative; | |
} | |
.ellipsis:before { | |
content: ' '; | |
visibility: hidden; | |
} | |
.ellipsis span { |
This file contains 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 { useRef, useState, useEffect } from 'react'; | |
// Usage | |
function App() { | |
const [hoverRef, isHovered] = useHover(); | |
return ( | |
<div ref={hoverRef}> | |
{isHovered ? '😁' : '☹️'} | |
</div> |
This file contains 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
"use strict"; | |
// Load plugins | |
const autoprefixer = require("autoprefixer"); | |
const browsersync = require("browser-sync").create(); | |
const cp = require("child_process"); | |
const cssnano = require("cssnano"); | |
const del = require("del"); | |
const eslint = require("gulp-eslint"); | |
const gulp = require("gulp"); |
This file contains 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
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
# CSS | |
ExpiresByType text/css "access plus 1 year" | |
# Data interchange | |
ExpiresByType application/atom+xml "access plus 1 hour" |
This file contains 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
{# Language switcher #} | |
{# Loop through all of the site locales, except the current one #} | |
{% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %} | |
{% for locale in otherLocales %} | |
{# Is this an entry page? #} | |
{% if entry is defined %} | |
{# Find the current entry in the other locale #} | |
{% set localeEntry = craft.entries.id(entry.id).locale(locale).first %} |