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 * as React from 'react'; | |
type FocusIndex = number | null; | |
/** | |
* A React hook for managing focus of elements in a list based on keyboard | |
* arrows (up and down). Great for a11y and UX. | |
* | |
* This hook does not deal with the actual imperative `.focus()` part at all. | |
* It solely calculates the which index in a list which should currently be |
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
/* | |
* This script fetches all color styles from a Figma team/document. | |
* | |
* Dependencies: | |
* | |
* - node-fetch | |
* | |
* Due to a limitation in the Figma /styles endpoint, we need to use a | |
* document for actually using the colors in a color grid 🙄That's why | |
* we're both fetching from /styles and /files below. |
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
interface Route { | |
pattern: URLPattern; | |
handler: Handler; | |
options: { | |
method: Method; | |
}; | |
} | |
export type Handler = (req: Request) => Promise<Response> | Response; |
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 * as preact from 'preact'; | |
import { DOMAttrs, DOMEvent, JSXElement, CSS, Ref, RefObject } from './types'; | |
import { useContext, useEffect, useId, useMemo, useRef, useState } from 'preact/hooks'; | |
import { classNames } from '@lookback/shared'; | |
import { forwardRef, memo } from 'preact/compat'; | |
interface Props { | |
button: JSXElement | ((isExpanded: boolean) => JSXElement); | |
style?: CSS; | |
} |
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
fn main() { | |
let lol: Option<&str> = Some("lol"); | |
if lol.is_none() { | |
// do some error handling | |
return; | |
} | |
// I'd love if `lol` was asserted to be Some("lol") | |
// below this if clause. |
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
/* | |
* This script fetches all color styles from a Figma team/document. | |
* | |
* Due to a limitation in the Figma /styles endpoint, we need to use a | |
* document for actually using the colors in a color grid 🙄That's why | |
* we're both fetching from /styles and /files below. | |
* | |
* For now, you need to input the page and team IDs, as well as the file keys. | |
* The team ID is in the Figma URL of your team, and the file key is the long | |
* string in the full URL of a Figma file. The page ID is visible in the JSON |
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
type ValidClass = string | number | undefined | null | ObjectClass; | |
type ObjectClass = { | |
[key: string]: boolean | undefined; | |
}; | |
type ClassName = ValidClass | ValidClass[]; | |
/** | |
* Easier class names management for JSX elements. |
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
// tslint:disable no-let | |
/** Return: | |
* | |
* - `< 0` if `a` comes before `b`. | |
* - `0` if `a` and `b` are equal. | |
* - `> 0` if `a` comes after `b`. | |
*/ | |
type Comparator<T> = (a: T, b: T) => number; |
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, { Fragment, cloneElement } from 'react'; | |
import { | |
useTooltip, | |
TooltipPopup, | |
TooltipProps, | |
Position, | |
} from './reach-tooltip'; | |
interface Props { | |
isVisible?: boolean; |
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
:root { | |
--sans: Quicksand, sans-serif; | |
--serif: Neuton, serif; | |
--font-size: 24px; | |
--lineheight: 1.6; | |
--spacing: calc(var(--lineheight) * 1rem); | |
/* Colours */ |
NewerOlder