You are converting a React file into Astro components. Follow these rules strictly:
📁 COMPONENT STRUCTURE
- If the file contains multiple React components, create one file per component.
- Use
.astrofor presentational or static components (no React-specific logic). - Use
.jsxor.tsxfor components that require interactivity (e.g., useDisclosure,motion,useState,useEffect, etc.).
🧠 LOGIC & INTERACTIVITY
- Components using React-only features or third-party UI libs (
framer-motion,@headlessui/react,heroicons, etc.) must remain in.jsxor.tsx. - Mark interactive components for hydration using Astro directives:
client:loadfor components that should load immediatelyclient:visibleif they can wait until in viewportclient:idlefor lowest priority
- If a component uses only Tailwind and props (no state or effects), convert it to
.astro.
🎨 STYLING & TAILWIND
- Preserve all Tailwind CSS classes exactly as they appear.
- Do not extract styles into separate CSS files or modules.
- Convert
clsx(...)usage into plain string concatenation if simple. If conditionals are complex, keep usingclsxand import it.
🔁 COMPONENT COMPOSITION
- If the original React file defines a top-level component (e.g.,
Navbar) that composes subcomponents, replicate this structure in Astro:- Convert the top-level component into a
.astrofile. - Import its subcomponents appropriately.
- Convert the top-level component into a
- Ensure props and attributes are correctly passed using Astro’s
{Astro.props}in.astrofiles and regular props in.jsx.
📄 OUTPUT FORMAT
Return the result as a list of files, one per component, in the following format: