Files
shadcn-ui/apps/www/hooks/use-lift-mode.ts
shadcn 7590fb7636 feat: lift mode (#3380)
* feat(www): wip break everything

* feat(www): wip chunks

* feat(www): wip chunk mode

* feat: lift mode

* feat: update chunks

* fix: resize in lift mode

* fix: hasLiftMode

* fix: types

* fix: toolbar

Thanks @mrnbpt

* chore: format check

* feat: add tracking for enable_lift_mode

* chore: format write

* docs: add changelog
2024-04-05 21:28:05 +04:00

22 lines
493 B
TypeScript

import { useAtom } from "jotai"
import { atomWithStorage } from "jotai/utils"
const configAtom = atomWithStorage<string[]>("lift-mode", [])
export function useLiftMode(name: string) {
const [chunks, setChunks] = useAtom(configAtom)
function toggleLiftMode(name: string) {
setChunks((prev) => {
return prev.includes(name)
? prev.filter((n) => n !== name)
: [...prev, name]
})
}
return {
isLiftMode: chunks.includes(name),
toggleLiftMode,
}
}