Skip to content

Commit

Permalink
feat(): Sonner component.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Feb 23, 2024
1 parent 5ef0c29 commit def2501
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export * from "./shadcn/ui/toggle";
export * from "./shadcn/ui/toggle-group";
export * from "./shadcn/ui/tooltip";
export * from "./shadcn/ui/use-toast";
export * from './shadcn/ui/sonner'
export * from "./tailwindTheme";
export * from "./utils";


4 changes: 2 additions & 2 deletions src/shadcn/ui/sonner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import { useTheme } from "next-themes"
import { Toaster as Sonner } from "sonner"
import { Toaster as Sonner, toast} from "sonner"

type ToasterProps = React.ComponentProps<typeof Sonner>

Expand All @@ -28,4 +28,4 @@ const Toaster = ({ ...props }: ToasterProps) => {
)
}

export { Toaster }
export const sonner = {Toaster, toast }
27 changes: 27 additions & 0 deletions stories/shadcn/sonner.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";

import { Button, sonner } from "src";

const SonnerDemo = () => {
return (
<div>


<sonner.Toaster >

</sonner.Toaster>
<Button onClick={() => sonner.toast.success('Success!')}>Show Toast</Button> </div>
);
}

const meta: Meta<typeof SonnerDemo> = {
component: SonnerDemo,
};

export default meta;

export const Default: StoryObj<typeof SonnerDemo> = {
args: {},
};

0 comments on commit def2501

Please sign in to comment.