Common Components
Common components are several components designed to be used throughout your website.
What's Included
< ActiveLink />
The ActiveLink component is a custom link designed to look like a button. It highlights active links based on the current URL, providing visual feedback to users when they are one a specific page or section.
ActiveLink Usage
<nav>
<ActiveLink href="/home" ghost={false}>
Home
</ActiveLink>
<ActiveLink href="/about">About</ActiveLink>
</nav>ActiveLink Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the button. | undefined |
href | string | The destination URL for the link. If href is not provided, the component renders a standalone button without navigation. | undefined |
active | boolean | Manually sets the link as active. Overrides the automatic active state detection. | false |
ghost | boolean | Controls the button's visual style when inactive. | true |
...props | object | Additional props passed to the component. | {} |
< Box />
The Box component is a versatile container designed to wrap its children with customizable styling. It serves as a foundational layout component that can be styled and configured using additional classes and props.
Box Usage
import styles from './styles.module.css';
<Box className="styles.customBox" style={{ padding: '20px' }}>
<p>This is a content inside the Box component.</p>
</Box>;Box Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the component. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. | {} |
< CallToAction />
The CallToAction component is a styled button designed to navigate users to a specified path when clicked.
CallToAction Usage
<CallToAction text="Get Started" path="/start" />CallToAction Props
| Name | Type | Description | Default |
|---|---|---|---|
text | string | The text displayed inside the button. | undefined |
path | string | The URL path where the user will be redirected upon clicking the component. | undefined |
< Card />
The Card component is a flexible container designed to wrap and display content in a visually distinct and styled manner. It is ideal for organizing content sections, showcasing information, and enhancing the presentation of grouped elements.
Card Usage
<Card>
<img src="/path/to/image.jpg" alt="Product Image" />
<figcaption>Product Name</figcaption>
</Card>Card Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the component. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. These props are spread onto the <figure> element. | {} |
< ColorfulButton />
The ColorfulButton component is a large, visually engaging button designed to draw attention with its unique styling.
ColorfulButton Usage
<ColorfulButton onClick={() => alert('Button clicked!')}>
Click Me
</ColorfulButton>ColorfulButton Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the component. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. | {} |
< Breadcrumbs />
The Breadcrumbs component is a navigation aid designed to display the current page's path as clickable breadcrumb links.
Breadcrumbs Usage
type BreadcrumbReplaceType = Array<{
find: string;
replace: string;
}>;
const breadcrumbReplace: BreadcrumbReplaceType = [
{ find: 'home', replace: 'Dashboard' },
];
<Breadcrumbs separator=">" breadcrumbReplace={breadcrumbReplace} />;Breadcrumbs Props
| Name | Type | Description | Default |
|---|---|---|---|
separator | ReactNode | The separator between each breadcrumb link. | / |
breadcrumbReplace | Array<object> | An array of objects specifying text replacements for specific path segments. See usage for more details on its type. | [] |
< ContentSection />
The ContentSection component is a flexible layout component designed to display content alongside an image. It allows for easy customization and layout adjustments, including reversing the order of content and image.
ContentSection Usage
import styles from './styles.module.css';
<ContentSection
content={<p>This is some text content.</p>}
image={<img src="/path/to/image.jpg" alt="Example" />}
reverse={true}
className={styles.section}
/>;ContentSection Props
| Name | Type | Description | Default |
|---|---|---|---|
content | ReactNode | The content to be displayed in the section. | undefined |
image | ReactNode | The image or media to be displayed in the section. Typically an <img> element. | undefined |
reverse | boolean | When set to true, reverses the order of the content and the image, displaying the image first. | false |
className | string | Additional CSS class names to apply to the component. | undefined |
< DropdownLink />
The DropdownLink component renders a dropdown menu with a list of navigational links. It is designed to display a dropdown of links that are shown when the user hovers over the main link.
DropdownLink Usage
type NavLinkType = {
title: string;
nav: Array<{
title: string;
url: string;
}>;
};
const navLink: NavLinkType = {
title: 'Services',
nav: [
{ title: 'Web Development', url: '/services/web-dev' },
{ title: 'App Development', url: '/services/app-dev' },
{ title: 'SEO Optimization', url: '/services/seo' },
],
};
<DropdownLink link={navLink} />;DropdownLink Props
| Name | Type | Description | Default |
|---|---|---|---|
link* | object | An object representing the main link and its associated dropdown items. See usage for detailed type information. | {} |
< EmptyState />
The EmptyState component provides a visual cue when no data or entries are available in a specific section of the application. It optionally displays a call-to-action button that navigates the user to a relevant page, depending on the permissions granted.
EmptyState Usage
<EmptyState title="Item" link="/add-item" permission={true} />EmptyState Props
| Name | Type | Description | Default |
|---|---|---|---|
title | string | The title used within the call-to-action button text. | undefined |
permission | boolean | A flag that determines whether the call-to-action button should be rendered. | undefined |
link | string | null | The URL path to which the user will be redirected when the action button is clicked. If null, the button is not displayed. | null |
< ImageSlider />
The ImageSlider component is a responsive image carousel built using the Swiper library. It allows you to display a series of images with pagination controls, making it ideal for showcasing image galleries, product images, or any other visual content that requires smooth sliding functionality.
ImageSlider Usage
const images = [
'/images/photo1.jpg',
'/images/photo2.jpg',
'/images/photo3.jpg',
];
<ImageSlider images={images} title="Sample Image Gallery" />;ImageSlider Props
| Name | Type | Description | Default |
|---|---|---|---|
images | Array<string> | An array of image URLs to be displayed in the slider. | [] |
title | string | A descriptive title for the slider images, used as the alt attribute for each image. | "" |
< List />
The List component is a styled list that allows you to render lists or grouped content together. It is meant to be used together with ListItem.
List Usage
<List>
<ListItem label="Name" value="John Doe" />
<ListItem label="Age" value="30" />
<ListItem label="Location" value="New York" />
</List>List Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the list. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. | {} |
< ListItem />
The ListItem component is a styled list item that is meant to be used inside a List component.
ListItem Usage
<List>
<ListItem label="Name" value="John Doe" />
<ListItem label="Age" value="30" />
<ListItem label="Location" value="New York" />
</List>ListItem Props
| Name | Type | Description | Default |
|---|---|---|---|
label | ReactNode | The label or key of the item, displayed on the left side. | undefined |
value | ReactNode | The value associated with the label, displayed on the right side. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. | {} |
< MenuItem />
The MenuItem component renders a navigable menu item, styled with optional active and featured states.
MenuItem Usage
type MenuDataType = {
path: string;
name?: ReactNode;
icon?: ReactNode;
chip?: string;
};
const menuData: MenuDataType = {
path: '/home',
name: 'Home',
icon: <HomeIcon />,
chip: 'New', // Optional chip to display additional information
};
<nav>
<MenuItem data={menuData} featured onClick={() => console.log('Clicked!')} />
</nav>;MenuItem Props
| Name | Type | Description | Default |
|---|---|---|---|
data | object | Contains the data for the menu item. See usage for details on its type. | undefined |
featured | boolean | Flag to apply special styles to highlight the item as featured. | false |
onClick | function | Callback function triggered when the menu item is clicked. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
< Section />
The Section component provides a flexible and styled container for grouping related content within a web page.
Section Usage
<Section>
<h2>Featured Content<h2>
<p>This section highlights important information<p>
</Section>Section Props
| Name | Type | Description | Default |
|---|---|---|---|
children | ReactNode | The content to be displayed inside the component. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
...props | object | Any other props passed to the component. | {} |
< Widget />
The Widget component is a versatile container designed for displaying content with a customizable header.
Widget Usage
import styles from './styles.module.css';
<Widget
title="User Statistics"
rightActions={<button>Refresh</button>}
className={styles.widget}
titleClassName={styles.widgetTitle}
>
<p>Content goes here...</p>
</Widget>;Widget Props
| Name | Type | Description | Default |
|---|---|---|---|
title | ReactNode | The title displayed in the header of the widget. | undefined |
rightActions | ReactNode | Elements or actions placed on the right side of the header, typically used for buttons, icons, or other interactive controls. | undefined |
children | ReactNode | The content to be displayed inside the component. | undefined |
className | string | Additional CSS class names to apply to the component. | undefined |
titleClassName | string | Additional CSS class names to apply to the title of the component. | undefined |