-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
401cd3b
commit 23d8130
Showing
12 changed files
with
198 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"solidui-cli": patch | ||
--- | ||
|
||
feat: add sonner component |
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,13 @@ | ||
{ | ||
"name": "sonner", | ||
"dependencies": [ | ||
"solid-sonner" | ||
], | ||
"files": [ | ||
{ | ||
"name": "sonner.tsx", | ||
"content": "import type { Component, ComponentProps } from \"solid-js\"\n\nimport { Toaster as Sonner } from \"solid-sonner\"\n\ntype ToasterProps = ComponentProps<typeof Sonner>\n\nconst Toaster: Component<ToasterProps> = (props) => {\n return (\n <Sonner\n class=\"toaster group\"\n toastOptions={{\n classes: {\n toast:\n \"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg\",\n description: \"group-[.toast]:text-muted-foreground\",\n actionButton: \"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground\",\n cancelButton: \"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground\"\n }\n }}\n {...props}\n />\n )\n}\n\nexport { Toaster }\n" | ||
} | ||
], | ||
"type": "ui" | ||
} |
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,22 @@ | ||
import { toast } from "solid-sonner" | ||
|
||
import { Button } from "~/registry/ui/button" | ||
|
||
export default function SonnerDemo() { | ||
return ( | ||
<Button | ||
variant="outline" | ||
onClick={() => | ||
toast("Event has been created", { | ||
description: "Sunday, December 03, 2023 at 9:00 AM", | ||
action: { | ||
label: "Undo", | ||
onClick: () => console.log("Undo") | ||
} | ||
}) | ||
} | ||
> | ||
Show Toast | ||
</Button> | ||
) | ||
} |
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,25 @@ | ||
import type { Component, ComponentProps } from "solid-js" | ||
|
||
import { Toaster as Sonner } from "solid-sonner" | ||
|
||
type ToasterProps = ComponentProps<typeof Sonner> | ||
|
||
const Toaster: Component<ToasterProps> = (props) => { | ||
return ( | ||
<Sonner | ||
class="toaster group" | ||
toastOptions={{ | ||
classes: { | ||
toast: | ||
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg", | ||
description: "group-[.toast]:text-muted-foreground", | ||
actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground", | ||
cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground" | ||
} | ||
}} | ||
{...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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<MDXHeader title="Sonner" description="An opinionated toast component for Solid." /> | ||
|
||
<ComponentPreview name="sonner-demo" /> | ||
|
||
## About | ||
|
||
`solid-sonner` is built and maintained by [wobsoriano](https://github.com/wobsoriano). | ||
|
||
## Installation | ||
|
||
<Tabs defaultValue="cli"> | ||
|
||
<TabsList> | ||
<TabsTrigger value="cli">CLI</TabsTrigger> | ||
<TabsTrigger value="manual">Manual</TabsTrigger> | ||
</TabsList> | ||
|
||
<TabsContent value="cli"> | ||
|
||
```bash | ||
npx solidui-cli@latest add sonner | ||
``` | ||
|
||
</TabsContent> | ||
|
||
<TabsContent value="manual"> | ||
<Steps> | ||
|
||
<Step>Install the following dependencies: </Step> | ||
|
||
```bash | ||
npm install solid-sonner | ||
``` | ||
|
||
<Step>Copy and paste the following code into your project: </Step> | ||
|
||
<ComponentSource name="sonner" /> | ||
|
||
<Step>Add the Toaster component:</Step> | ||
|
||
```tsx{1,9} | ||
import { Toaster } from "~/components/ui/sonner" | ||
export default function RootLayout({ children }) { | ||
return ( | ||
<html lang="en"> | ||
<head /> | ||
<body> | ||
<main>{children}</main> | ||
<Toaster /> | ||
</body> | ||
</html> | ||
) | ||
} | ||
``` | ||
|
||
</Steps> | ||
</TabsContent> | ||
|
||
</Tabs> | ||
|
||
## Usage | ||
|
||
```tsx | ||
import { toast } from "solid-sonner" | ||
``` | ||
|
||
```tsx | ||
toast("Event has been created.") | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.