Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
aa3c0c6
Lift position wrapper to Toaster
timolins Dec 24, 2020
b43caa1
Add missing goober setup
timolins Dec 24, 2020
802fe9e
Merge remote-tracking branch 'origin/main' into lift-position-wrapper
timolins Jan 21, 2021
633cb6f
Increase default duration from loading toasts to Infinity
timolins Mar 2, 2021
3836611
Merge branch 'infinity-loading' into dev
timolins Mar 6, 2021
8a3ac8c
Merge branch 'clear-timeouts' into dev
timolins Mar 6, 2021
2d52e4e
Merge branch 'lift-position-wrapper' into dev
timolins Mar 6, 2021
06e271c
Move height ref to <Toaster/>
timolins Mar 14, 2021
781b16f
Change toast positioning to absolute
timolins Mar 21, 2021
41aac06
Merge branch 'lift-position-wrapper' into dev
timolins Mar 21, 2021
396db8b
Improve animations and exit positioning
timolins Mar 21, 2021
d60adb6
Update goober & add `csstype` as dev dependency
timolins Mar 21, 2021
8f82fec
Breaking: No longer expose `dispatch`
timolins Mar 21, 2021
641369f
Set `sideEffects: false` in package.json
timolins Mar 21, 2021
207bf66
Add `renderToast` option to Toatser
timolins Mar 21, 2021
345aac0
Add support for per toast position
timolins Mar 21, 2021
2be3b23
Add `containerClassName` prop
timolins Mar 21, 2021
e58d6a8
Use React.CSSProperties instead csstype
timolins Mar 22, 2021
b7509bd
Add support for `toast.custom`
timolins Mar 22, 2021
25690e0
Refactor `Indicator` to `ToastIcon` component
timolins Mar 22, 2021
664bcbf
Fix invalid types/imports
timolins Mar 22, 2021
1a584db
Merge branch 'main' into dev
timolins Mar 22, 2021
80e936f
Allow position to be configured per toast
timolins Mar 22, 2021
6639eea
Use dynamic year in footer
timolins Mar 22, 2021
39f85aa
Merge remote-tracking branch 'origin/main' into dev
timolins Apr 26, 2021
b650ea0
CSS fix for IE
D-32 May 5, 2021
0363011
Add reduce motion support
timolins May 16, 2021
f1d367c
Scope aria props and add render function support
timolins May 16, 2021
466825d
Reduce custom toast duration to 4 seconds
timolins May 16, 2021
273e29e
Expose `gutter` prop
timolins May 16, 2021
9381c26
Use flexbox for toast positioning
timolins May 16, 2021
ff9a762
Extract default offset to variable
timolins May 16, 2021
8388051
Use children instead of render prop
timolins May 16, 2021
2036a3f
Use activeClass for pointer events
timolins May 16, 2021
03d75e9
Fix sticky nav in docs
timolins May 16, 2021
cfbf32a
Add tailwind animation for examples
timolins May 16, 2021
ad49ba0
2.0.0-beta.0
timolins May 16, 2021
b2f4611
Update docs for 2.0
timolins May 16, 2021
809fa25
fix: remove unused import
ruisaraiva19 May 17, 2021
b22bacb
Merge pull request #82 from ruisaraiva19/fix/nextjs-build
timolins May 17, 2021
6c89e91
fix(toast-bar): use fragment to remove unique key prop error
ruisaraiva19 May 24, 2021
7af1a17
Merge pull request #83 from ruisaraiva19/dev
timolins May 25, 2021
e448a6e
docs: fix typo on custom toaster
ruisaraiva19 May 25, 2021
468c303
Merge pull request #84 from ruisaraiva19/dev
timolins May 25, 2021
8057bb3
Add fade animation to reduce motion
timolins May 28, 2021
013deef
Clean up keyframe strings
timolins May 28, 2021
23d3db5
Fix prettier
timolins May 28, 2021
a35ebb3
Merge pull request #76 from D-32/css-ie-fix
timolins May 28, 2021
7587f5e
Update docs for 2.0 release
timolins May 28, 2021
d182844
Add rehype-slug for same page linking
timolins May 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "react-hot-toast",
"version": "1.0.2",
"version": "2.0.0-beta.0",
"author": "Timo Lins",
"license": "MIT",
"sideEffects": false,
"repository": "timolins/react-hot-toast",
"keywords": [
"react",
Expand Down Expand Up @@ -60,10 +61,11 @@
"@size-limit/preset-small-lib": "^4.9.1",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"csstype": "^3.0.7",
"size-limit": "^4.9.1",
"tsdx": "^0.14.1"
},
"dependencies": {
"goober": "^2.0.15"
"goober": "^2.0.35"
}
}
3 changes: 2 additions & 1 deletion site/components/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ const theme: PrismTheme = {

export const Code: React.FC<{
snippet: string;
language?: Language;
className?: string;
}> = (props) => {
const language = (props.className?.replace(/language-/, '') as any) || 'jsx';
const language = props.language || 'jsx';

return (
<Highlight
Expand Down
11 changes: 7 additions & 4 deletions site/components/docs-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const TableItem: React.FC<{
href: string;
}> = ({ children, href }) => (
<Link href={href}>
<a className="rounded px-3 py-2 transition-colors duration-200 relative block hover:text-toast-500 text-toast-700">
<a className="rounded px-3 py-1.5 transition-colors duration-200 relative block hover:text-toast-500 text-toast-700">
{children}
</a>
</Link>
Expand Down Expand Up @@ -53,22 +53,25 @@ export default function DocsLayout({ children, meta }) {
GitHub
</a>
</header>
<nav className="font-medium rounded-lg">
<div className="flex flex-col mb-8">
<nav className="font-medium rounded-lg ">
<div className="flex flex-col mb-8 sticky top-0">
<TableHeader>Overview</TableHeader>

<TableItem href="/docs">Get Started</TableItem>

<TableHeader>API</TableHeader>

<TableItem href="/docs/toast">toast()</TableItem>
<TableItem href="/docs/toaster">Toaster</TableItem>
<TableItem href="/docs/toaster">{`Toaster`}</TableItem>
<TableItem href="/docs/toast-bar">{`ToastBar`}</TableItem>
<TableItem href="/docs/use-toaster">useToaster()</TableItem>
<TableItem href="/docs/use-toaster-store">
useToasterStore()
</TableItem>
<TableHeader>Guides</TableHeader>
<TableItem href="/docs/styling">Styling</TableItem>
<TableHeader>Releases</TableHeader>
<TableItem href="/docs/version-2">New in 2.0</TableItem>
</div>
</nav>

Expand Down
100 changes: 98 additions & 2 deletions site/components/sections/toast-example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,102 @@ const examples: Array<{
});
},
},
{
title: 'Custom Position',
emoji: '⬆️',
snippet: `toast.success('Always at the bottom.', {
position: "bottom-center"
})`,
action: () => {
toast.success('Always at the bottom.', {
position: 'bottom-center',
duration: 10000,
});
},
},
{
title: 'TailwindCSS',
emoji: '️💨',
snippet: `toast.custom((t) => (
<div
className={\`\${
t.visible ? 'animate-enter' : 'animate-leave'
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5\`}
>
<div className="flex-1 w-0 p-4">
<div className="flex items-start">
<div className="flex-shrink-0 pt-0.5">
<img
className="h-10 w-10 rounded-full"
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"
alt=""
/>
</div>
<div className="ml-3 flex-1">
<p className="text-sm font-medium text-gray-900">
Emilia Gates
</p>
<p className="mt-1 text-sm text-gray-500">
Sure! 8:30pm works great!
</p>
</div>
</div>
</div>
<div className="flex border-l border-gray-200">
<button
onClick={() => toast.dismiss(t.id)}
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"
>
Close
</button>
</div>
</div>
))`,
action: () => {
// toast.custom(<TestApp />);

toast.custom(
(t) => (
<div
className={`${
t.visible ? 'animate-enter' : 'animate-leave'
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5`}
>
<div className="flex-1 w-0 p-4">
<div className="flex items-start">
<div className="flex-shrink-0 pt-0.5">
<img
className="h-10 w-10 rounded-full"
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"
alt=""
/>
</div>
<div className="ml-3 flex-1">
<p className="text-sm font-medium text-gray-900">
Emilia Gates
</p>
<p className="mt-1 text-sm text-gray-500">
Sure! 8:30pm works great!
</p>
</div>
</div>
</div>
<div className="flex border-l border-gray-200">
<button
onClick={() => toast.dismiss(t.id)}
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"
>
Close
</button>
</div>
</div>
),
{
duration: 10000,
}
);
},
},
];

export const ToastExample = () => {
Expand Down Expand Up @@ -196,8 +292,8 @@ export const ToastExample = () => {
))}
</div>
</div>
<div className="md:h-72 w-full overflow-hidden">
<Code snippet={snippet} />
<div className="md:h-72 w-full overflow-auto rounded-lg">
<Code snippet={snippet} className="!h-auto min-h-full" />
</div>
</section>
);
Expand Down
9 changes: 7 additions & 2 deletions site/next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
const withTM = require('next-transpile-modules')(['react-hot-toast']);
const remarkSlugs = require('rehype-slug');

const withMDX = require('@next/mdx')({
extension: /\.mdx?$/,
extension: /.mdx?$/,
options: {
rehypePlugins: [remarkSlugs],
},
});
const withPlugins = require('next-compose-plugins');

const withSvgr = (nextConfig = {}, nextComposePlugins = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
config.module.rules.push({
test: /\.svg$/,
test: /.svg$/,
use: ['@svgr/webpack'],
});

Expand Down
Loading