This project demonstrates a customizable dropdown component with various features such as searchable options, portal support, multiple selections, and custom option rendering. The component is built using React, Storybook, and Tailwind CSS.
Follow these instructions to set up and run the project locally.
Clone the repository:
git clone <repository-url>
cd <repository-directory>
Run Dependencies: ```bash npm install
Running the Project To start the Component development server, run the application, Storybook and view the components This will start Storybook and open it in your default web browser at http://localhost:6006.
npm run storybook
To Download this package to your react project simply use
npm install dropdown-testing-app
Then use
import Dropdown from 'dropdown-testing-app'
Next, create 2 files in your root folder called .babelrc
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"ignore": ["/node_modules/(?!dropdown-testing-app)/"]
}
babel.config.js
module.exports = {
presets: [
'@babel/preset-env',
'@babel/preset-react'
],
ignore: [/node_modules\/(?!dropdown-testing-app)/]
};
Then, make sure you are also install rewired and customized-cra
Rewired
npm install --save-dev react-app-rewired
customized-cra
npm install --save-dev customize-cra
Then, add config-override.js
const { override, addBabelPreset, babelInclude } = require('customize-cra');
const path = require('path');
module.exports = override(
addBabelPreset('@babel/preset-react'),
babelInclude([
path.resolve('src'),
path.resolve('node_modules/dropdown-testing-app')
])
);
Lastly, change the scripts on your package.json to:
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
}