Section Components
This document introduces the section components in SaaS Starter. These components are located in the src/components/sections/ directory and are used to build the main content blocks of pages.
Hero
Hero banner section component:
import { Hero } from "@/components/sections/hero";
<Hero
dict={dict}
params={params}
showTrustBar={true}
/>Props
dict- Internationalization dictionary objectparams- Route parametersshowTrustBar- Whether to show the trust bar
Variants
- Left-aligned layout
- Center-aligned layout
- Right-aligned layout
Features
Feature showcase section:
import { Features } from "@/components/sections/features";
<Features
dict={dict}
variant="grid"
columns={3}
/>Props
dict- Internationalization dictionary objectvariant- Layout variant (grid/list)columns- Number of grid columns
Features
- Responsive grid layout
- Icon support
- Animation effects
- Custom styling
ContentSection
Content display section:
import { ContentSection } from "@/components/sections/content-section";
<ContentSection
title="Section Title"
description="Section Description"
image="/path/to/image.jpg"
imagePosition="right"
/>Props
title- Section titledescription- Section descriptionimage- Image pathimagePosition- Image position (left/right)
Layout Options
- Image and text side-by-side layout
- Text-only layout
- Background image layout
CTASection
Call-to-action section:
import { CTASection } from "@/components/sections/cta-section";
<CTASection
dict={dict}
variant="primary"
showBackground={true}
/>Variants
PrimaryCTA- Primary styleGradientCTA- Gradient backgroundMinimalCTA- Minimal style
Props
dict- Internationalization dictionary objectvariant- Style variantshowBackground- Whether to show background
FAQ
Frequently asked questions section:
import { FAQ } from "@/components/sections/faq";
<FAQ
dict={dict}
columns={2}
expandFirst={true}
/>Props
dict- Internationalization dictionary objectcolumns- Number of columnsexpandFirst- Whether to expand the first item
Features
- Collapsible panels
- Search filtering
- Category display
Testimonials
User testimonials section:
import { Testimonials } from "@/components/sections/testimonials";
<Testimonials
dict={dict}
variant="grid"
autoplay={true}
/>Props
dict- Internationalization dictionary objectvariant- Display style (grid/slider)autoplay- Whether to autoplay
Features
- Grid layout
- Carousel display
- Responsive design
Best Practices
Section Combination Guide
- Homepage Layout Example
export default function HomePage({ params }) {
const dict = await getDictionary(params.lang);
return (
<Layout dict={dict}>
<Hero dict={dict} params={params} />
<Features dict={dict} />
<ContentSection {...contentProps} />
<Testimonials dict={dict} />
<FAQ dict={dict} />
<CTASection dict={dict} />
</Layout>
);
}- Product Page Example
<Layout dict={dict}>
<Hero variant="product" />
<Features columns={4} />
<ContentSection imagePosition="left" />
<PricingSection />
<TestimonialsSlider />
<GradientCTA />
</Layout>Performance Optimization
- Image Handling
- Use appropriate image formats
- Implement lazy loading
- Provide responsive images
- Animation Effects
- Use CSS animations
- Implement progressive enhancement
- Consider reducing animations
- Content Loading
- Implement progressive loading
- Optimize above-the-fold content
- Use placeholders
Responsive Design
- Layout Adaptation
- Use fluid layouts
- Adapt to different screens
- Adjust content density
- Image Handling
- Use responsive images
- Adjust image sizes
- Optimize mobile display
- Interaction Optimization
- Adapt for touch operations
- Optimize form experience
- Adjust button sizes
Accessibility
- Semantic Tags
- Use correct HTML tags
- Add ARIA labels
- Provide alternative text
- Keyboard Operation
- Support keyboard navigation
- Set logical focus order
- Provide keyboard shortcuts
- Color Contrast
- Ensure text readability
- Provide sufficient contrast
- Support high contrast mode
Internationalization Support
- Text Translation
- Use dictionary files
- Support dynamic content
- Handle long text
- Image Localization
- Provide localized images
- Adapt for different languages
- Consider cultural differences
- Layout Adjustment
- Support text direction
- Handle character length
- Adapt for different fonts
Last updated on: