A collection of reusable React components including collapsible panels, array transformers, and API data viewers — built with modern React (React 18), Jest, and Storybook.
| Component | Description |
|---|---|
CollapsiblePanel |
A simple expandable/collapsible panel |
StringArrayTransformer |
Parses, transforms, sorts, and manipulates arrays of strings |
DataDisplay |
Fetches and displays data from an external API |
Navbar |
Navigation bar with route support |
HomePage |
Landing page showcasing all components |
ImageLoader |
Loads an image URL from a JSON file fetched via REST API and displays it |
- Built with React 18
- Uses React Router v6
- Includes Jest unit tests
- Storybook integration for visual development
- Responsive and accessible design
- Fully self-contained components
Make sure you have the following installed:
- Node.js (v16 or higher)
- npm or yarn
Clone the repo:
git clone https://github.com/yourusername/js-component-lib.git
cd js-component-libInstall dependencies:
npm install
# or
yarn installStart the development server:
npm start
# or
yarn startOpen http://localhost:3000 in your browser.
npm run storybook
# or
yarn storybookVisit http://localhost:6006 to explore stories for each component.
Run Jest tests:
npm test
# or
yarn testTo run tests in watch mode:
npm run test:watch
# or
yarn test --watchjs-component-lib/
├── public/
├── src/
│ ├── components/ # Reusable React components
│ ├── pages/ # Page-level components (e.g., HomePage)
│ ├── App.jsx # Main routing & layout
│ └── main.jsx # Entry point
├── __tests__/ # Jest test files
├── stories/ # Storybook stories
├── package.json
├── jest.config.js # Jest configuration
└── README.md| Script | Description |
|---|---|
npm start |
Starts the development server |
npm run build |
Builds the production version |
npm test |
Runs Jest unit tests |
npm run test:watch |
Runs tests in watch mode |
npm run storybook |
Starts Storybook UI |
npm run build-storybook |
Builds static Storybook site |
- The
DataDisplayfetches data from an external API and displays it. Make sure the API is running when you test this component. - All components are designed to be reusable and should work in different React projects.
- The
StringArrayTransformercomponent includes multiple transformation options (sort, filter, etc.) and can be used in various data processing scenarios. - The
Navbarcomponent includes route support and should be used as the main navigation for the application. - The
HomePagecomponent showcases all the available components and serves as a demonstration of how they can be used together. - The
ImageLoadercomponent fetches a JSON file containing an image URL, displays the image dynamically, handles loading and error states, and supports drag-and-drop file uploads - All components are written in modern React (React 18) and use functional components with hooks.
- The project includes Storybook for visual testing and component documentation.
- The project includes Jest unit tests for each component to ensure reliability.
- Add more complex data transformation options to
StringArrayTransformer - Implement additional API endpoints for
DataDisplay - Add more components to the library
- Improve accessibility features
- Add more test coverage
This project is licensed under the GPL License - see the LICENSE file for details.