Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 from "react"; | |
| // prettier-ignore | |
| export interface BasicHtmlTableProps { head?: React.ReactNode[][]; body?: React.ReactNode[][]; foot?: React.ReactNode[][]; tStyle?: React.CSSProperties; p?(cell: React.ReactNode): Record<string, any>; } | |
| // prettier-ignore | |
| export const BasicHtmlTable = ({ head, body, foot, tStyle = { border: "1px solid black" }, p = (cell: any) => ({ key: Math.random(), children: cell, style: tStyle }) }: BasicHtmlTableProps) => { | |
| const headJsx = head?.map((r) => <tr {...p(r.map((c, i) => <th {...p(c)} />))}/>); // prettier-ignore | |
| const bodyJsx = body?.map((r) => <tr {...p(r.map((c, i) => <td {...p(c)} />))}/>); // prettier-ignore | |
| const footJsx = foot?.map((r) => <tr {...p(r.map((c, i) => <td {...p(c)} />))}/>); // prettier-ignore | |
| return ( | |
| <table style={tStyle}> |
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 extendDeep(target) { | |
| // Run through rest parameters | |
| Array.prototype.slice.call(arguments, 1).forEach(function (source) { | |
| if (typeof target === "object") { | |
| if (typeof source === "object") { | |
| // If source is an array, only copy enumerable properties | |
| var keys = (Array.isArray(source) ? Object.keys(source) : Object.getOwnPropertyNames(source)); | |
| // Iterate over keys | |
| keys.forEach(function (key) { |
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 { createElement } from "react"; | |
| export function Box({ children, as = "div", ...props }) { | |
| return createElement(as, props, [...children]); | |
| } | |
| /* | |
| // example |
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
| <div class="bird"> | |
| <div class="head"></div> | |
| <div class="body"> | |
| <div class="wing"></div> | |
| </div> | |
| <div class="dams"> | |
| <div class="dam dam-1"></div> | |
| <div class="dam dam-2"></div> | |
| <div class="dam dam-3"></div> | |
| <div class="dam dam-4"></div> |
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 { ImageBackground, SafeAreaView, View } from "react-native"; | |
| import React from "react"; | |
| // the pièce de résistance | |
| const OptionalParent = ({ children, Parent, cond }) => | |
| Parent != null && cond | |
| ? React.cloneElement(Parent, null, children) | |
| : children; |
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, { useState, useEffect } from 'react' | |
| import { render } from 'react-dom' | |
| import { useTrail, animated } from 'react-spring' | |
| import './styles.css' | |
| const config = { mass: 5, tension: 2000, friction: 200 } | |
| function Message({ items, next: Next }) { | |
| const [toggle, set] = useState(false); | |
| const [showNext, setShowNext] = useState(false); |
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, { useEffect } from 'react'; | |
| import { useSpring, animated } from 'react-spring'; | |
| const trans = (x, y, s) => `perspective(600px) rotateX(${x}deg) rotateY(${y}deg) scale(${s})`; | |
| export default function Floater({ children }) { | |
| const ref = React.createRef(); | |
| let height = 1; | |
| let width = 1; | |
| let xOffset = 1; |
NewerOlder