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.

<nav>
  <ActiveLink href="/home" ghost={false}>
    Home
  </ActiveLink>
  <ActiveLink href="/about">About</ActiveLink>
</nav>
NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the button.undefined
hrefstringThe destination URL for the link. If href is not provided, the component renders a standalone button without navigation.undefined
activebooleanManually sets the link as active. Overrides the automatic active state detection.false
ghostbooleanControls the button's visual style when inactive.true
...propsobjectAdditional 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

NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the component.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny 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

NameTypeDescriptionDefault
textstringThe text displayed inside the button.undefined
pathstringThe 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

NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the component.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny 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

NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the component.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny 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.

type BreadcrumbReplaceType = Array<{
  find: string;
  replace: string;
}>;
 
const breadcrumbReplace: BreadcrumbReplaceType = [
  { find: 'home', replace: 'Dashboard' },
];
 
<Breadcrumbs separator=">" breadcrumbReplace={breadcrumbReplace} />;
NameTypeDescriptionDefault
separatorReactNodeThe separator between each breadcrumb link./
breadcrumbReplaceArray<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

NameTypeDescriptionDefault
contentReactNodeThe content to be displayed in the section.undefined
imageReactNodeThe image or media to be displayed in the section. Typically an <img> element.undefined
reversebooleanWhen set to true, reverses the order of the content and the image, displaying the image first.false
classNamestringAdditional 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.

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} />;
NameTypeDescriptionDefault
link*objectAn 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

NameTypeDescriptionDefault
titlestringThe title used within the call-to-action button text.undefined
permissionbooleanA flag that determines whether the call-to-action button should be rendered.undefined
linkstring | nullThe 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

NameTypeDescriptionDefault
imagesArray<string>An array of image URLs to be displayed in the slider.[]
titlestringA 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

NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the list.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny 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

NameTypeDescriptionDefault
labelReactNodeThe label or key of the item, displayed on the left side.undefined
valueReactNodeThe value associated with the label, displayed on the right side.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny other props passed to the component.{}

< MenuItem />

The MenuItem component renders a navigable menu item, styled with optional active and featured states.

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>;
NameTypeDescriptionDefault
dataobjectContains the data for the menu item. See usage for details on its type.undefined
featuredbooleanFlag to apply special styles to highlight the item as featured.false
onClickfunctionCallback function triggered when the menu item is clicked.undefined
classNamestringAdditional 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

NameTypeDescriptionDefault
childrenReactNodeThe content to be displayed inside the component.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
...propsobjectAny 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

NameTypeDescriptionDefault
titleReactNodeThe title displayed in the header of the widget.undefined
rightActionsReactNodeElements or actions placed on the right side of the header, typically used for buttons, icons, or other interactive controls.undefined
childrenReactNodeThe content to be displayed inside the component.undefined
classNamestringAdditional CSS class names to apply to the component.undefined
titleClassNamestringAdditional CSS class names to apply to the title of the component.undefined