Skip to content

Commit 932493b

Browse files
authored
Merge pull request #405 from timolins/replace-tailwind-animations-with-transitions
[Docs] Replace confusing animate-enter/animate-leave with custom animations
2 parents 8892a84 + 863f1f6 commit 932493b

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

site/components/sections/splitbee-counter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const SplitbeeCounter = () => {
4949
{letters.map((l, i) => (
5050
<div
5151
className={clsx(
52-
'animate-enter',
52+
'animate-custom-enter',
5353
'bg-toast-100 rounded p-4 text-lg font-bold font-mono'
5454
)}
5555
key={i + '-' + l}

site/components/sections/toast-example.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const examples: Array<{
188188
snippet: `toast.custom((t) => (
189189
<div
190190
className={\`\${
191-
t.visible ? 'animate-enter' : 'animate-leave'
191+
t.visible ? 'animate-custom-enter' : 'animate-custom-leave'
192192
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5\`}
193193
>
194194
<div className="flex-1 w-0 p-4">
@@ -227,7 +227,7 @@ const examples: Array<{
227227
(t) => (
228228
<div
229229
className={`${
230-
t.visible ? 'animate-enter' : 'animate-leave'
230+
t.visible ? 'animate-custom-enter' : 'animate-custom-leave'
231231
} max-w-md w-full bg-white shadow-lg rounded-lg pointer-events-auto flex ring-1 ring-black ring-opacity-5`}
232232
>
233233
<div className="flex-1 w-0 p-4">

site/pages/docs/version-2.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ toast.custom(<div>Minimal Example</div>);
4646
toast.custom((t) => (
4747
<div
4848
className={`bg-white px-6 py-4 shadow-md rounded-full ${
49-
t.visible ? 'animate-enter' : 'animate-leave'
49+
t.visible ? 'animate-custom-enter' : 'animate-custom-leave'
5050
}`}
5151
>
5252
Hello TailwindCSS! 👋
@@ -60,7 +60,7 @@ toast.custom((t) => (
6060
toast.custom((t) => (
6161
<div
6262
className={`bg-white px-6 py-4 shadow-md rounded-full ${
63-
t.visible ? 'animate-enter' : 'animate-leave'
63+
t.visible ? 'animate-custom-enter' : 'animate-custom-leave'
6464
}`}
6565
>Hello from TailwindCSS! 👋</div>
6666
))

site/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export default function Home() {
143143
/>
144144
</div>
145145
<div className="text-center my-12 relative duration-200">
146-
<h1 className="text-3xl md:text-4xl animate-enter font-bold text-toast-900">
146+
<h1 className="text-3xl md:text-4xl animate-custom-enter font-bold text-toast-900">
147147
The Best Toast in Town.
148148
</h1>
149149
<h2 className="text-xl md:text-2xl font-bold text-toast-600 mt-2">

site/tailwind.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ module.exports = {
1818
'-1px 2px 5px rgba(81, 41, 10, 0.15), 0px 1px 1px rgba(81, 41, 10, 0.15)',
1919
},
2020
animation: {
21-
enter: 'enter 200ms ease-out',
21+
'custom-enter': 'custom-enter 200ms ease-out',
22+
'custom-leave': 'custom-leave 150ms ease-in forwards',
2223
'slide-in': 'slide-in 1.2s cubic-bezier(.41,.73,.51,1.02)',
23-
leave: 'leave 150ms ease-in forwards',
2424
},
2525
keyframes: {
26-
enter: {
26+
'custom-enter': {
2727
'0%': { transform: 'scale(0.9)', opacity: 0 },
2828
'100%': { transform: 'scale(1)', opacity: 1 },
2929
},
30-
leave: {
30+
'custom-leave': {
3131
'0%': { transform: 'scale(1)', opacity: 1 },
3232
'100%': { transform: 'scale(0.9)', opacity: 0 },
3333
},

0 commit comments

Comments
 (0)