Skip to content

Instantly share code, notes, and snippets.

@michu2k
michu2k / post-03-incorrect-format.tsx
Last active December 17, 2023 12:55
Validate data in browser storage with Zod
// User storage values
{gridView: true, sortBy: "firstName"}
// Previously data model
{gridView: Boolean!, sortBy: String!}
// New data model - Retrieved "sortBy" value from storage is a string, but the "SortArray" is expected.
{gridView: Boolean!, sortBy: SortArray!}
@michu2k
michu2k / post-02-stories.tsx
Created December 9, 2023 13:25
Storybook 7 Integration with Next.js
// ...
import {AVATAR_SIZE} from "./Avatar.utils";
import AvatarJpg from "public/avatar.jpg";
// ...
type Story = StoryObj<typeof meta>;
/** Default Avatar variant */
@michu2k
michu2k / post-01-animations.tsx
Last active December 9, 2023 12:54
Animated modal component with Framer-motion
const defaultModalAnimation: AnimationProps = {
transition: {duration: 0.2, delay: 0.1, ease: "easeInOut"},
initial: {opacity: 0, scale: 0.9, y: 20},
animate: {opacity: 1, scale: 1, y: 0},
exit: {
opacity: 0,
transition: {
duration: 0.2
}
}