This repository contains a React component-based Alert Design System built with TypeScript and SASS preprocessor for styling. The system utilizes Lucide icons for alert symbols and adheres to two SOLID principles:
The Alert Design System consists of the following React components:
The Alert
component serves as the main container for displaying various types of alerts. It accepts props and children for configuring the alert's type, header icon, title, and optional description. The component encapsulates the alert's visual presentation and behavior.
The AlertType
type defines the different types of alerts supported by the system, including alert-default
, alert-info
, alert-danger
, alert-success
, and alert-warning
. This type helps maintain consistency and clarity when specifying the type of alert.
The alert system utilizes SASS preprocessor for CSS styling, enhancing maintainability and organization of stylesheets. Each alert type is styled separately to ensure visual consistency and flexibility for future modifications. SASS variables and mixins are employed to promote code reusability and scalability.
To use the Alert Design System in your React application:
-
Install the necessary dependencies:
npm install lucide-react sass
-
Import the
Alert
component and required Lucide icons into your application:import Alert from "./components/ui/Alert/Alert"; import { BellRing, Info, Ban, CheckCheck, TriangleAlert, } from "lucide-react";
-
Incorporate the
Alert
component within your application, specifying the desired alert type, header icon, title, and optional description.<Alert type={"alert-default"} headerIcon={<BellRing size={20} />} title="Upgrade your plan" description?="Optional field can be neglected and use the children props instead" > {/* Alert content */} if(need to use children) </Alert>
-
Customize the alert styling by modifying the SASS variables and mixins according to your design requirements.
The Alert Design System provides a robust foundation for displaying various types of alerts in React applications. By adhering to SOLID principles, utilizing TypeScript for type safety, employing SASS preprocessor for styling, and integrating Lucide icons for visual representation, the system offers flexibility, maintainability, and scalability for alert management.