Skip to content

Commit 6834737

Browse files
committed
fix: update docs website with new useToast API
1 parent 57dac25 commit 6834737

File tree

4 files changed

+35
-36
lines changed

4 files changed

+35
-36
lines changed

website/app/components/examples.tsx

+31-32
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ const Positions = () => {
5353
const iconSize = 14;
5454

5555
const handleChangePosition = (position: Position) => {
56-
t.open({
56+
t.success({
5757
text: `Position changed`,
58-
variant: 'info',
5958
description: `Position changed to ${position}`,
6059
});
6160
setToastPosition(position);
@@ -124,50 +123,50 @@ const Theme = () => {
124123

125124
const handleChangeTheme = (theme: Theme | undefined) => {
126125
if (theme === undefined) {
127-
t.open({
126+
t.success({
128127
text: 'Theme reset to default',
129-
variant: 'success',
130128
});
131129
} else {
132-
t.open({
130+
t.success({
133131
text: `Theme changed to ${theme}`,
134-
variant: 'success',
135132
});
136133
}
137134
setToastTheme(theme);
138135
};
139136

140137
return (
141138
<div className="flex flex-col space-y-2">
142-
<div className="flex items-center space-x-2 py-2">
143-
<Button variant="outline" onClick={() => handleChangeTheme(undefined)}>
139+
<div className="flex items-center justify-between">
140+
<div className="flex items-center space-x-2 py-2">
141+
<Button
142+
variant="outline"
143+
className={toastTheme === 'light' ? activeBtn : ''}
144+
onClick={() => handleChangeTheme('light')}
145+
>
146+
{toastTheme === 'light' ? (
147+
<CheckIcon size={iconSize} />
148+
) : (
149+
<SunIcon size={iconSize} />
150+
)}
151+
<span>light</span>
152+
</Button>
153+
<Button
154+
variant="outline"
155+
className={toastTheme === 'dark' ? activeBtn : ''}
156+
onClick={() => handleChangeTheme('dark')}
157+
>
158+
{toastTheme === 'dark' ? (
159+
<CheckIcon size={iconSize} />
160+
) : (
161+
<MoonIcon size={iconSize} />
162+
)}
163+
<span>dark</span>
164+
</Button>
165+
</div>
166+
<Button variant="ghost" onClick={() => handleChangeTheme(undefined)}>
144167
<RefreshCcwIcon size={iconSize} />
145168
<span>reset</span>
146169
</Button>
147-
<Button
148-
variant="outline"
149-
className={toastTheme === 'light' ? activeBtn : ''}
150-
onClick={() => handleChangeTheme('light')}
151-
>
152-
{toastTheme === 'light' ? (
153-
<CheckIcon size={iconSize} />
154-
) : (
155-
<SunIcon size={iconSize} />
156-
)}
157-
<span>light</span>
158-
</Button>
159-
<Button
160-
variant="outline"
161-
className={toastTheme === 'dark' ? activeBtn : ''}
162-
onClick={() => handleChangeTheme('dark')}
163-
>
164-
{toastTheme === 'dark' ? (
165-
<CheckIcon size={iconSize} />
166-
) : (
167-
<MoonIcon size={iconSize} />
168-
)}
169-
<span>dark</span>
170-
</Button>
171170
</div>
172171
<ProviderCodeBlock label="theme" value={toastTheme || 'system'} />
173172
</div>

website/app/components/header.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const Header = () => {
1111
return (
1212
<nav
1313
className={cn(
14-
'sticky top-0 z-50 bg-white/90 backdrop-blur-sm dark:bg-neutral-900/90',
15-
'flex w-full border-b border-neutral-200 py-3 shadow-sm dark:border-neutral-800',
14+
'sticky top-0 z-50 bg-neutral-50/90 backdrop-blur-sm dark:bg-neutral-900/90',
15+
'flex w-full py-3 dark:border-neutral-800',
1616
)}
1717
>
1818
<div className="container flex max-w-7xl items-center justify-between">

website/app/components/hero.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Hero = () => {
2222
<Button
2323
variant="default"
2424
onClick={() =>
25-
toast.open({
25+
toast.default({
2626
text: 'pheralb/toast',
2727
description: '✨ A beautiful toast library for React',
2828
})

website/app/root.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ function App() {
7070
'text-neutral-900 dark:text-neutral-50',
7171
)}
7272
>
73-
<Header />
7473
<ToastProvider
7574
position={toastPosition}
7675
theme={toastTheme ? toastTheme : theme!}
7776
toastFont="font-sans"
7877
>
78+
<Header />
7979
<div className="container w-full max-w-7xl">
8080
<SidebarContent />
8181
<article

0 commit comments

Comments
 (0)