A small React + Vite demo that uses Tailwind CSS (with DaisyUI), Recharts, and Axios to demonstrate a pricing UI and small charts. It includes:
- Responsive Navbar components
- A Pricing options grid (cards) populated from
public/PricingData.json
- A Book reservations Bar chart populated from
public/booksData.json
(fetched with Axios) - A Result Line chart (Recharts) example
This README explains how to run the project locally, where the main files are, and a few troubleshooting tips.
- Node.js (v16+ recommended)
- npm (or yarn)
- Open a terminal and change into the project folder (this folder contains package.json):
cd "E:\Practice Project\React\tailwind-react-pricing"
- Install dependencies (if you haven't already):
npm install
- Start the dev server:
npm run dev
- Open the URL Vite prints (usually http://localhost:5173) in your browser.
Build for production:
npm run build
Preview the production build locally:
npm run preview
src/components/Navbar/Navbar.jsx
— responsive navbar and link handling (keys added for list items; hover area improved).src/components/PricingOptions/PricingOption.jsx
— fetchesPricingData.json
, renders pricing cards, shows features with Lucide icons, and includes Subscribe buttons.src/components/BookData/BookData.jsx
— fetchesbooksData.json
with Axios and renders a responsive Recharts BarChart for member/book data.src/components/Charts/ResultCharts.jsx
— responsive Recharts LineChart example with smooth (type="monotone"
) curves.tailwind.config.js
— Tailwind config (ES module) set up to scan the project and enable DaisyUI plugin.public/PricingData.json
andpublic/booksData.json
— demo JSON data used by the components (files inpublic/
are served at project root, e.g./booksData.json
).
Place static JSON files in public/
so they are served at the root of the dev server. Example:
public/booksData.json
→ available athttp://localhost:5173/booksData.json
public/PricingData.json
→ available athttp://localhost:5173/PricingData.json
Notes:
- The BookData component accepts either a single object or an array in
booksData.json
. If you want multiple chart bars as groups, makebooksData.json
an array of objects.
- Recharts components are imported from
recharts
. If your editor auto-imports a wrong symbol (for example Lucide icons with similar names), manually add therecharts
import line. Examples are insrc/components/Charts/ResultCharts.jsx
andsrc/components/BookData/BookData.jsx
. - To make lines smooth use
type="monotone"
(orbasis
/natural
) on<Line />
.
- Tailwind utilities are included via
src/App.css
andtailwind.config.js
. If you add new content files or change thecontent
globs, restart the dev server so Tailwind picks up new classes.
- Blank page after starting dev server: ensure you ran
npm run dev
frome:\Practice Project\React\tailwind-react-pricing
(the folder with package.json). Running it from the parent folder will showMissing script: "dev"
. booksData.json
not found (404): confirm the file exists inpublic/
and fetch path is/booksData.json
.- Auto-import in VS Code suggests wrong symbol: accept the suggestion that includes
from "recharts"
or add the import manually. - If you see runtime errors from
use()
or Suspense: that pattern is for Server Components — this project uses client-side fetching (useEffect/axios). Do not calluse()
in client components.
- Create a feature branch
- Make edits, run and test locally
- Commit and open a PR