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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>Starling AIX — Storybook (Draft)</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com" /> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | |
| <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Serif+Text:ital@0;1&display=swap" rel="stylesheet" /> | |
| <style> |
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
| /* | |
| Usage: | |
| <NiceGradient index={9} style={StyleSheet.absoluteFill} /> | |
| Where index is an index from gradients array (0...14) based on https://www.behance.net/gallery/62158409/Gradients-Color-Style | |
| */ | |
| import React from 'react'; | |
| import { LinearGradient } from 'expo-linear-gradient'; | |
| export const gradients = [ | |
| ['#FF6CAB', '#7366FF'], |
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 React, { | |
| createContext, | |
| useState, | |
| useContext, | |
| ReactNode, | |
| FunctionComponent, | |
| Dispatch, | |
| SetStateAction, | |
| } from 'react'; |
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 { NextRequest, NextResponse } from 'next/server'; | |
| import { checkAuth } from './checkAuth'; // define it by yourself | |
| const httpMethods = ['GET', 'POST', 'PUT', 'DELETE'] as const; | |
| type MethodMap<T> = { GET?: T; POST?: T; PUT?: T; DELETE?: T }; | |
| export default function authGuard(options?: MethodMap<boolean>) { | |
| return function AuthGuard(given: Function) { | |
| const ctr = given as Omit<Function, 'prototype'> & { |
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 { useEffect, useRef } from 'react'; | |
| /** | |
| * | |
| * @example | |
| * const ref = useClickOutside<HTMLDivElement>((evt: MouseEvent) => console.log('blah')) | |
| * <div ref={ref} /> | |
| */ | |
| type ClickEvent = MouseEvent & { target: HTMLElement }; |
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 { useEffect } from 'react'; | |
| interface Props { | |
| selector: string; | |
| className?: string; | |
| onClick: (evt: Event) => void; | |
| } | |
| const QuerySelector = ({ | |
| selector, |
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 { TouchableOpacity, TouchableNativeFeedback, Platform } from 'react-native'; | |
| import { createElement } from 'react'; | |
| // use TouchableNativeFeedback for android and TouchableOpacity for ios | |
| // use TouchableOpacity with activeOpacity=1 for both platforms if disabled=true | |
| const Touchable = ({ | |
| disabled, | |
| onPress, | |
| ...props | |
| }) => { |
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
| /* | |
| A hook for creating observable-like immutable arrays based on useState | |
| in other words allows to call push, pull, slice... methods which are going to deliver | |
| a new array every time and trigger component to re-render | |
| Usage: | |
| const [array, arrayRef] = useArrayState(initialValue = []); | |
| arrayRef.push(foo); // triggers component to re-render and makes 'array' to update |
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
| /* | |
| Usage: | |
| const [value, setTrue, setFalse] = useBooleanState(initialValue); | |
| */ | |
| import { useState, useCallback } from "react"; | |
| export default function useBooleanState(initialValue) { | |
| const [value, onSetValue] = useState(initialValue); | |
| const onSetTrue = useCallback(() => onSetValue(true), []); |
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
| ( function( win, doc, s_add, s_rem ) { | |
| if( doc[s_add] ) return; | |
| Element.prototype[ s_add ] = win[ s_add ] = doc[ s_add ] = function( on, fn, self ) { | |
| return (self = this).attachEvent( 'on' + on, function(e){ | |
| var e = e || win.event; | |
| e.target = e.target || e.srcElement; | |
| e.preventDefault = e.preventDefault || function(){e.returnValue = false}; | |
| e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}; | |
| e.which = e.button ? ( e.button === 2 ? 3 : e.button === 4 ? 2 : e.button ) : e.keyCode; | |
| fn.call(self, e); |
NewerOlder