Skip to content

Instantly share code, notes, and snippets.

@jake-nz
Last active July 30, 2021 06:34
Show Gist options
  • Save jake-nz/5ea0bcc8e5e0df42b1048bb769726e5f to your computer and use it in GitHub Desktop.
Save jake-nz/5ea0bcc8e5e0df42b1048bb769726e5f to your computer and use it in GitHub Desktop.
Component Lib
import {Thing as BaseThing} from 'shared/components/Thing'
export const Thing = styled(BaseThing, {
// This app needs Things in upper case
textTransform: 'uppercase'
})
import {Thing as ThingPrimitive} from 'shared/primitives/Thing'
export const Thing = styled(ThingPrimitive, {
display: 'flex',
borderColor: '$border',
height: '$thing',
...
})
const Thing = (props) => {
const [on, setOn] = useState(false)
return (
<button data-state={on ? "on" : "off"} onClick={() => setOn(on => !on)} {...props} />
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment