Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
keiko233 committed Dec 3, 2024
1 parent ab3553a commit 3830a13
Show file tree
Hide file tree
Showing 6 changed files with 799 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/components/src/dialog/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { cn, tcva, type VariantProps } from "@nyanpasu/material-design-libs";

export const dialogOverlayClassName = cn(
"fixed inset-0 z-50",
"backdrop-blur-xl",
"bg-opacity-10 bg-primary",
);

export const dialogContainerClassName = cn(
"fixed inset-0 z-50 grid place-items-center",
);

export const dialogContentVariants = tcva(["bg-surface"], {
variants: {
fullScreen: {
true: "fixed inset-0",
false: "min-w-96 rounded-3xl shadow",
},
},
defaultVariants: {
fullScreen: false,
},
});

export interface DialogContentVariantsProps
extends VariantProps<typeof dialogContentVariants> {}
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./button";
export * from "./dialog";
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@nyanpasu/material-design-components": "workspace:^",
"@nyanpasu/material-design-libs": "workspace:^",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-slot": "^1.1.0",
"ahooks": "^3.8.1",
"framer-motion": "12.0.0-alpha.2",
Expand Down
172 changes: 172 additions & 0 deletions packages/react/src/dialog/dialog.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
import type { Meta, StoryObj } from "@storybook/react";
import { motion } from "framer-motion";
import React from "react";
import { Button } from "../button";
import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogHeader,
DialogTrigger,
} from "./";

type Story = StoryObj<typeof Dialog>;

export default {
title: "Components/Dialog",
component: Dialog,
} as Meta<typeof Dialog>;

export const Default: Story = {
decorators: [
() => (
<Dialog>
<DialogTrigger asChild>
<Button asChild>
<motion.button>open dialog</motion.button>
</Button>
</DialogTrigger>

<DialogContent
contentPrefix={<DialogHeader>Nyanpasu</DialogHeader>}
contentSuffix={
<DialogFooter>
<Button variant="flat">Submit</Button>
<DialogClose>Close</DialogClose>
</DialogFooter>
}
>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
</DialogContent>
</Dialog>
),
],
};

export const FullScreen: Story = {
decorators: [
() => (
<Dialog>
<DialogTrigger asChild>
<Button asChild>
<motion.button>open dialog</motion.button>
</Button>
</DialogTrigger>

<DialogContent
fullScreen
contentPrefix={<DialogHeader>Nyanpasu</DialogHeader>}
contentSuffix={
<DialogFooter>
<Button variant="flat">Submit</Button>
<DialogClose>Close</DialogClose>
</DialogFooter>
}
>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
<div>my content</div>
</DialogContent>
</Dialog>
),
],
};
Loading

0 comments on commit 3830a13

Please sign in to comment.