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
vec3 palette(float t) { | |
vec3 a = vec3(0.5, 0.5, 0.5); | |
vec3 b = vec3(0.5, 0.5, 0.5); | |
vec3 c = vec3(1.0, 1.0, 0.5); | |
vec3 d = vec3(0.80, 0.90, 0.30); | |
return a + b * cos(6.28318 * (c * t + d)); | |
} | |
vec3 col = palette(uv.y + 0.5); |
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
uniform vec2 u_resolution; | |
uniform float u_time; | |
uniform sampler2D u_diffuse; | |
uniform sampler2D u_dataTexture; | |
uniform float u_amplitude; | |
varying vec2 v_uv; | |
vec3 correctGamma(vec3 color) { |
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
/* eslint-disable @typescript-eslint/no-unused-vars */ | |
/* eslint-disable max-len */ | |
import { StitchesCss, createCss } from '@stitches/react' | |
export const config = createCss({ | |
prefix: '', | |
theme: { | |
colors: { | |
grey50: '#F9F9F9', | |
grey100: '#EAEDF0', |
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 styled from 'styled-components' | |
const variants = ({ variant }) => { | |
const allVariants = { | |
danger: { | |
backgroundColor: 'red', | |
}, | |
warning: { | |
backgroundColor: 'orange', | |
}, |
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
const balancedSum = (arr) => { | |
// Find the left and right parts of the array, start from the middle cos it's as good a place as any | |
let i = Math.floor(arr.length / 2) | |
let left = arr.slice(0, i).reduce((a, b) => a + b, 0) | |
let right = arr.slice(i + 1).reduce((a, b) => a + b, 0) | |
// If they're equal, you beauty | |
if (left === right) { | |
return i | |
} |
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
/** @jsx jsx */ | |
import { jsx } from "@emotion/react"; | |
import { useRef, useEffect } from "react"; | |
import { Box, BoxProps, Image } from "@phobon/base"; | |
import { motion } from "framer-motion"; | |
const MotionImage = motion.custom(Image); | |
export interface IShiftImageProps { | |
loading?: "eager" | "lazy"; |
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
// App.js | |
import { Provider } from "jotai"; | |
import { Layout } from "./Layout"; | |
const App = ({ children }) => { | |
return ( | |
<Provider> | |
<Layout> | |
{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
export const ParentComponent = ({ ...props }) => { | |
const name = useState(null); | |
const address = useState(null); | |
const other = useState(null); | |
const fields = [name, address, other]; | |
return ( | |
<form> | |
{fields.map(([field, setField], index) => ( |
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
const dataAtom = atom({}); | |
const Form = ({ code, name, categories, dimensions, setData, ...props }) => { | |
const [code, setCode] = useState(() => code); | |
const [name, setName] = useState(() => name); | |
const [categories, setCategories] = useState(() => categories); | |
const [dimensions, setDimensions] = useState(() => dimensions); | |
const updateData = e => setData({ | |
code, |
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 fetchLedBrands = async () => { | |
// This can be sourced from anything, an api endpoint etc. | |
//[ | |
// { id: 1, label: "a" }, | |
// { id: 2, label: "b" }, | |
// { id: 3, label: "c" }, | |
// { id: 4, label: "d" }, | |
// { id: 5, label: "e" }, | |
//]; | |
NewerOlder