36
loading...
This website collects cookies to deliver better user experience
Nextjs
and install tailwindcss and some other npm packages.npm install -D tailwindcss@latest postcss@latest autoprefixer@latest animated-tailwindcss
yarn add tailwindcss@latest postcss@latest autoprefixer@latest animated-tailwindcss -D
yarn
or npm install
in the file and it will download the dependencies in your file. Then generate the tailwind.config.js
and postcss.config.js
files by running this command in the terminal.npx tailwindcss init -p
tailwind.config.js
code with this code:const withAnimations = require("animated-tailwindcss");
module.exports = withAnimations({
purge: ["./pages/**/*.{js,ts,jsx,tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
});
animated-tailwindcss
npm package to implement the animate.css classes in our tailwind className.global.css
.@tailwind base;
@tailwind components;
@tailwind utilities;
global.css
file is imported into your _app.js
file.skeleton
and bolts
for the className.id=Skeleton
so you have to pass the props to every part you want to animate that you can find easily if you gave them the proper name for id.index.js
file.// pages/index.js
import PhoneSvg from "../components/PhoneSvg";
export default function Home()
{
return <PhoneSvg skeleton="" bolt1="" bolt2="" bolt3="" bolt4="" bolt5="" />;
}
// pages/index.js
import PhoneSvg from "../components/PhoneSvg";
export default function Home() {
return (
<PhoneSvg
skeleton=" animate-animated animate-fadeInUp animate-fast animate-repeat-1"
bolt1="animate-animated animate-fadeInDown animate-slow animate-delay-1s"
bolt2="animate-animated animate-fadeInDown animate-slow"
bolt3="animate-animated animate-fadeInDown animate-slow"
bolt4="animate-animated animate-fadeInDown animate-slow animate-delay-1s"
bolt5="animate-animated animate-fadeInDown animate-slow animate-delay-1s"
/>
);
}