Skip to content

Commit 7587f5e

Browse files
committed
Update docs for 2.0 release
1 parent a35ebb3 commit 7587f5e

File tree

8 files changed

+455
-170
lines changed

8 files changed

+455
-170
lines changed

site/components/code.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ const theme: PrismTheme = {
103103

104104
export const Code: React.FC<{
105105
snippet: string;
106+
language?: Language;
106107
className?: string;
107108
}> = (props) => {
108-
const language = (props.className?.replace(/language-/, '') as any) || 'jsx';
109+
const language = props.language || 'jsx';
109110

110111
return (
111112
<Highlight

site/components/sections/toast-example.tsx

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,100 @@ const examples: Array<{
171171
},
172172
{
173173
title: 'Custom Position',
174-
emoji: '️',
174+
emoji: '️',
175175
snippet: `toast.success('Always at the bottom.', {
176176
position: "bottom-center"
177177
})`,
178178
action: () => {
179179
toast.success('Always at the bottom.', {
180180
position: 'bottom-center',
181+
duration: 10000,
181182
});
182183
},
183184
},
185+
{
186+
title: 'TailwindCSS',
187+
emoji: '️💨',
188+
snippet: `toast.custom((t) => (
189+
<div
190+
className={\`\${
191+
t.visible ? 'animate-enter' : 'animate-leave'
192+
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5\`}
193+
>
194+
<div className="flex-1 w-0 p-4">
195+
<div className="flex items-start">
196+
<div className="flex-shrink-0 pt-0.5">
197+
<img
198+
className="h-10 w-10 rounded-full"
199+
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixqx=6GHAjsWpt9&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.2&w=160&h=160&q=80"
200+
alt=""
201+
/>
202+
</div>
203+
<div className="ml-3 flex-1">
204+
<p className="text-sm font-medium text-gray-900">
205+
Emilia Gates
206+
</p>
207+
<p className="mt-1 text-sm text-gray-500">
208+
Sure! 8:30pm works great!
209+
</p>
210+
</div>
211+
</div>
212+
</div>
213+
<div className="flex border-l border-gray-200">
214+
<button
215+
onClick={() => toast.dismiss(t.id)}
216+
className="w-full border border-transparent rounded-none rounded-r-lg p-4 flex items-center justify-center text-sm font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"
217+
>
218+
Close
219+
</button>
220+
</div>
221+
</div>
222+
))`,
223+
action: () => {
224+
// toast.custom(<TestApp />);
225+
226+
toast.custom(
227+
(t) => (
228+
<div
229+
className={`${
230+
t.visible ? 'animate-enter' : 'animate-leave'
231+
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5`}
232+
>
233+
<div className="flex-1 w-0 p-4">
234+
<div className="flex items-start">
235+
<div className="flex-shrink-0 pt-0.5">
236+
<img
237+
className="h-10 w-10 rounded-full"
238+
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixqx=6GHAjsWpt9&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2.2&w=160&h=160&q=80"
239+
alt=""
240+
/>
241+
</div>
242+
<div className="ml-3 flex-1">
243+
<p className="text-sm font-medium text-gray-900">
244+
Emilia Gates
245+
</p>
246+
<p className="mt-1 text-sm text-gray-500">
247+
Sure! 8:30pm works great!
248+
</p>
249+
</div>
250+
</div>
251+
</div>
252+
<div className="flex border-l border-gray-200">
253+
<button
254+
onClick={() => toast.dismiss(t.id)}
255+
className="w-full border border-transparent rounded-none rounded-r-lg p-4 flex items-center justify-center text-sm font-medium text-indigo-600 hover:text-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"
256+
>
257+
Close
258+
</button>
259+
</div>
260+
</div>
261+
),
262+
{
263+
duration: 10000,
264+
}
265+
);
266+
},
267+
},
184268
];
185269

186270
export const ToastExample = () => {
@@ -208,8 +292,8 @@ export const ToastExample = () => {
208292
))}
209293
</div>
210294
</div>
211-
<div className="md:h-72 w-full overflow-hidden">
212-
<Code snippet={snippet} />
295+
<div className="md:h-72 w-full overflow-auto rounded-lg">
296+
<Code snippet={snippet} className="!h-auto min-h-full" />
213297
</div>
214298
</section>
215299
);

0 commit comments

Comments
 (0)