-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3-main' into create-guild-page
- Loading branch information
Showing
9 changed files
with
164 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client"; | ||
|
||
import ReactDOM from "react-dom"; | ||
|
||
export const PreloadResources = () => { | ||
ReactDOM.preload( | ||
"https://cdn.jsdelivr.net/fontsource/fonts/inter:vf@latest/latin-opsz-normal.woff2", | ||
{ | ||
as: "font", | ||
crossOrigin: "", | ||
type: "font/woff2", | ||
fetchPriority: "high", | ||
}, | ||
); | ||
ReactDOM.preload( | ||
"https://cdn.jsdelivr.net/fontsource/fonts/inter:vf@latest/latin-opsz-italic.woff2", | ||
{ | ||
as: "font", | ||
crossOrigin: "", | ||
type: "font/woff2", | ||
}, | ||
); | ||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client"; | ||
|
||
import { useTheme } from "next-themes"; | ||
import { Toaster as Sonner } from "sonner"; | ||
|
||
type ToasterProps = React.ComponentProps<typeof Sonner>; | ||
|
||
const Toaster = ({ ...props }: ToasterProps) => { | ||
const { theme = "system" } = useTheme(); | ||
|
||
return ( | ||
<Sonner | ||
theme={theme as ToasterProps["theme"]} | ||
className="toaster group" | ||
toastOptions={{ | ||
classNames: { | ||
toast: | ||
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg data-[button]:bg-button-primary-background gap-2 focus-visible:ring-2", | ||
description: "group-[.toast]:text-foreground-secondary", | ||
actionButton: | ||
"group-[.toast]:!bg-button-primary-background group-[.toast]:!text-button-primary-foreground", | ||
closeButton: | ||
"group-[.toast]:bg-background group-[.toast]:text-foreground group-[.toast]:border-border", | ||
}, | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export { Toaster }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Button } from "@/components/ui/Button"; | ||
import { Toaster } from "@/components/ui/Toaster"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { toast } from "sonner"; | ||
|
||
type ToastExampleProps = { | ||
title: string; | ||
description?: string; | ||
action?: boolean; | ||
closeButton?: boolean; | ||
}; | ||
const ToastExample = ({ | ||
title = "Toast example", | ||
description, | ||
action, | ||
closeButton, | ||
}: ToastExampleProps) => { | ||
return ( | ||
<> | ||
<Button | ||
onClick={() => | ||
toast(title, { | ||
description, | ||
action: action ? ( | ||
<Button size="xs" className="ml-auto min-w-max"> | ||
Action | ||
</Button> | ||
) : undefined, | ||
closeButton, | ||
}) | ||
} | ||
> | ||
Show toast! | ||
</Button> | ||
<Toaster /> | ||
</> | ||
); | ||
}; | ||
|
||
const meta: Meta<typeof ToastExample> = { | ||
title: "Design system/Toast", | ||
component: ToastExample, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof ToastExample>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: "Toast example", | ||
description: "", | ||
action: false, | ||
closeButton: false, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters