React JS

How to Create a Pixel Perfect Landing Page with Smooth Animations

How to Create a Pixel Perfect Landing Page with Smooth Animations

I am mesmerized, When I see this landing page create with React.js, I see perfection in motion a dance between subtle animations, modern design, and seamless user experience. It doesn’t just show credit cards; it celebrates them. The visuals are smooth, the green palette inviting, and the pixel-perfect precision screams professionalism. The page effortlessly blends function and aesthetics, ensuring every hover, transition, and scroll feels dynamic yet fluid. With the elegance of TailwindCSS and the power of React.js, this masterpiece sets a benchmark for modern UI design.

Code Implementation

Here’s how you can implement a similar design using React.js for the component structure, TailwindCSS for styling, and Static JSON for data handling.

Folder Structure

codesrc/
|-- components/
| |-- LandingPage.jsx
|-- assets/
| |-- creditcard.png
|-- data/
| |-- cardDetails.json
|-- App.jsx
|-- index.css
|-- index.js

Static JSON File (data/cardDetails.json)

This file contains the credit card details and user information:

code{
"title": "Discover the Perfect Credit Card for You",
"subTitle": "Choose from a range of secure and rewarding credit cards. Maximize your savings and control your finances today.",
"stats": [
{ "value": "16y", "label": "Experience" },
{ "value": "250+", "label": "Merchant Partners" },
{ "value": "18+", "label": "Years Experience" },
{ "value": "10.2k+", "label": "Worldwide Clients" }
],
"offers": [
{ "icon": "đź”’", "title": "Security Guarantee", "description": "Protect your finances with our top-tier security protocols." },
{ "icon": "đź’ą", "title": "Investing", "description": "Grow your wealth through exclusive financial tools." },
{ "icon": "đź’ł", "title": "Multiple Method", "description": "Flexible payments in all scenarios." }
]
}

Landing Page Component

Here’s the React component that pulls data from the JSON file and uses TailwindCSS:

codeimport React from "react";
import cardDetails from "../data/cardDetails.json";
import creditCardImg from "../assets/creditcard.png";

const LandingPage = () => {
const { title, subTitle, stats, offers } = cardDetails;

return (
<div className="bg-green-900 text-white min-h-screen">
{/* Header Section */}
<header className="text-center p-10">
<h1 className="text-4xl font-bold">{title}</h1>
<p className="text-gray-300 mt-4">{subTitle}</p>
</header>

{/* Stats Section */}
<section className="grid grid-cols-2 md:grid-cols-4 gap-6 text-center p-6">
{stats.map((stat, index) => (
<div key={index} className="bg-green-800 p-4 rounded-lg">
<h2 className="text-2xl font-bold">{stat.value}</h2>
<p className="text-sm text-gray-400">{stat.label}</p>
</div>
))}
</section>

{/* Card Animation */}
<section className="flex justify-center items-center p-10">
<img
src={creditCardImg}
alt="Credit Card"
className="animate-pulse w-1/2 sm:w-1/3"
/>
</section>

{/* Offers Section */}
<section className="p-10 grid grid-cols-1 md:grid-cols-3 gap-6">
{offers.map((offer, index) => (
<div
key={index}
className="p-6 bg-green-800 rounded-lg hover:scale-105 transition-transform"
>
<h3 className="text-3xl">{offer.icon}</h3>
<h4 className="text-xl font-bold mt-2">{offer.title}</h4>
<p className="text-gray-300 mt-2">{offer.description}</p>
</div>
))}
</section>
</div>
);
};

export default LandingPage;

App Component (App.jsx)

The main app to render the landing page:

codeimport React from "react";
import LandingPage from "./components/LandingPage";
import "./index.css";

function App() {
return (
<div className="App">
<LandingPage />
</div>
);
}

export default App;

CSS for Tailwind (index.css)

Ensure Tailwind is configured in your project and import it:

code@tailwind base;
@tailwind components;
@tailwind utilities;

Smooth Animations

  • Pulse Animation: Tailwind’s animate-pulse adds a smooth pulsing effect to the credit card image.
  • Hover Effects: hover:scale-105 provides subtle scaling on offers.

Conclusion

Using React.js, TailwindCSS, and a clean Static JSON, you can effortlessly create a stunning landing page that’s both responsive and visually appealing. Smooth animations and modular design make this implementation scalable and user-friendly.

Asim Sikka

About Asim Sikka

As a full-stack web developer with over 11 years of experience, I specialize in building dynamic and responsive applications using ReactJS, NextJS, and modern front-end technologies, I'm proficient in creating scalable, high-performance web solutions across multiple stacks, leveraging my expertise in both front-end and back-end development.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments