* feat(landing): slicing navigation bar * feat(landing): slicing hero section * feat(landing): slicing what we offer section * feat(landing): add animation on hero and what we offer section * feat(landing): slicing testimonial section * feat(landing): change the animation for what we offer section * feat: add utility for readable looping and conditional rendering of components * feat(landing): slicing faq section * feat(landing): change border radius of card on `what we offer` and `testimonial` section * feat(landing): slicing cta section * feat: modify accordion component * feat(landing): add shape background at faq section * feat(landing): slicing footer * feat: toggle header visibility on scroll
20 lines
621 B
TypeScript
20 lines
621 B
TypeScript
export interface ShowProps {
|
|
condition: boolean
|
|
children: React.ReactNode
|
|
fallback?: React.ReactNode | null
|
|
}
|
|
|
|
/**
|
|
* Conditionally renders the `children` component if `condition` is true. If
|
|
* `condition` is false, renders the `fallback` component instead.
|
|
*
|
|
* If `fallback` is `null`, renders nothing.
|
|
*
|
|
* @param condition - The condition to check
|
|
* @param children - The component to render if `condition` is true
|
|
* @param fallback - The component to render if `condition` is false
|
|
*/
|
|
export function Show({ condition, children, fallback = null }: ShowProps) {
|
|
return condition ? children : fallback
|
|
}
|