The simple-widgets library must be installed in your project:
npm install simple-widgets
This will allow access to all the CSS files in simple-widgets in every file in your project. The advantage is that you will not need to import the CSS files in files that need them. The disadvantage is that you can not change them to style them to your needs.
In the index.js, place the following:
import '../node_modules/simple-widgets/src/index.css'
This allows the CSS file to be imported into the file that needs it. The disadvantage is that since it is in the node_modules directory, you can not change them to style them to your needs. The CSS files can also be placed in the index.js. This allows them to be accessed by all javascript files.
An example, suppose you are using the DoubleListBox component in the file, you will need the following imports:
import '../node_modules/simple-widgets/lib/sw-theme.css'
import '../node_modules/simple-widgets/lib/sw-doubleListBox.css'
If the CSS file is being used in multiple files, the CSS file can be placed in the index.js file instead of each file that uses it.
- Copy the css files from the library into the public directory of your project.
cd your-project-name
cp ./node_modules/simple-widgets/src/*.css ./public/
-
Make copies of any CSS files you are planning on modifying. Remove the CSS files that are not needed.
-
Make the modifications to the CSS file.
In the file, that is going to use the modified file, you will need the following import
import '../public/name-of-the-file.css';
If the CSS file is being used in multiple files, the CSS file can be placed in the index.js file instead of the files that need it.
The css files in the simple-widgets source directory (src) are:
- sw-checkboxRadio.css
- sw-contextMenuHover.css
- sw-doubleListBox.css
- sw-DropDown.css
- sw-entryform.css
- sw-Header.css
- sw-inputFile.css
- sw-invalid.css
- sw-modal.css
- sw-NavBar.css
- sw-outline.css
- sw-slider1.css to sw-slider5.css
- sw-spreadSheet.css
- sw-table.css
- sw-theme.css
Each of these files are described in the documentation in which they are used.