5.2.1 • Published 2 years ago

@cianciarusocataldo/modular-ui v5.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

modular-ui

NPM npm (scoped) npm bundle size (scoped) Maintenance


Status

Security

Code Climate issues Code Climate technical debt Libraries.io dependency status for latest release, scoped npm package Snyk Vulnerabilities for npm package

Continuous Integration

Modular-ui CI AppVeyor CircleCI Cirrus CI - Specific Branch Build Status Scrutinizer build (GitHub/Bitbucket) Wercker CI Run

Code analysis

Codacy grade CodeFactor Grade Code Climate maintainability Language grade: JavaScript Scrutinizer code quality (GitHub/Bitbucket) Reviewed by Hound

Tests coverage

Codacy coverage Code Climate coverage Codecov Coveralls Scrutinizer coverage (GitHub/BitBucket)


Summary


Modular-ui philosophy

This library is built upon few (but important) concepts:

  • Small library size, to not impact on final app bundle size
  • Few dependencies, to not introduce a bunch of additional packages (that could also introduce bugs or version conflicts with pre-existent packages)
  • Let the user customize every part as desired, but with default values set otherwise, to make every component ready to be used without so many parameters
  • Every component should be integrable into every react app, so their behaviour must be customizable too (with callbacks, for example)

The same concepts are also the base of another project I maintain, modular-app, a ready to use react app template that use this library internally (check it out, it is also the base of Modular-ui guide page !)

Components building process

This library use a standardized process to build every component. As result, every component has a shared initial logic, shared CSS styles and shared properties.

Shared components properties

Some properties are shared between all components, for a smoother dev experience. In addition, this makes every single component easily re-usable. Let's see them in details:

PropertyDescription
classNamecustom className applied on main container
darkEnable/disable dark mode
hideHide/show component
iddata-id parameter (for testing purpose, to easily find the component into the DOM)
shadowEnable/disable shadow behind component
styleCss inline properties applied on main container
unstyledIf true, no standard modular-ui styles will be applied on the components (useful for example, with image buttons)

With these shared properties is possible to drive every component behaviour and UI with an external state management system (modular library uses these components internally in conjunction with redux)

Customizable UI

Modular-ui components UI is globally configurable, with CSS variables. By defining some specific custom CSS variables into your app css, you'll change the UI of all components:

CSS variableDescriptionDefault valueRelated CSS attribute
--modular-custom-background-darkComponents background, when in dark-mode (dark is set to true).linear-gradient(to right, #2d3748, #1d232e)background-image
--modular-custom-background-color-darkComponents background color, when in dark-mode (dark is set to true).#1d232ebackground-color
--modular-custom-text-color-darkComponents text color, when in dark-mode (dark is set to true).whitetext-color
--modular-custom-background-lightComponents background, when not in dark-mode (dark is set to false).linear-gradient(to right, #fff, #eaebec)background-image
--modular-custom-background-color-lightComponents background color, when not in dark-mode (dark is set to false).#f5f5f5background-color
--modular-custom-text-color-lightComponents text color, when not in dark-mode (dark is set to false).#1b1b1btext-color

If you don't set these variables, the default values will be used.

Box components

Some components are designed with a specific structure, to better control and customize their look and feel. This type of components is called Box Component, for their particular structure. In addition to the shared properties, as they are part of modular-ui, they accept 3 additional (and optional) properties:

  • label, a string or a component rendered above the final component
  • value, a specific property that drive the component UI, its type vary depends on component itself (for example, for the CheckBox component, it is the check status, as a boolean )
  • defaultValue, the default value to use when value is not given or is undefined

Getting started

Installation

If you want to use this library inside your project, just install it:

npm i @cianciarusocataldo/modular-ui

Usage

After installation, you can use every modular-ui component in your app. Run this example to see them in action:

import { Card, Container, Link } from "@cianciarusocataldo/modular-ui";
import { render } from "react-dom";

render(<Container animated>
          <Card
             dark={true}
             body={<p>This page is entirely made with modular-ui components !</p>}
             footer={<Link to="https://cianciarusocataldo.github.io/modular-ui">Modular-ui page</Link>}
          />
       </Container>,     
       document.getElementById("root"));

Edit modular-ui playground

If you want to customize the UI globally, initialize the dedicated CSS variables:

*{
  --modular-text-color : #f5f5f5;
  --modular-background-color: #1b1b1b;
 }

Tests

Unit tests for every component are located inside tests folder. The test script is executed with pre-defined test command:

npm run test

This lib is analyzed and tested with different automated code analysis systems:


Authors


License

This project is licensed under the MIT License - see the LICENSE file for details

5.1.1

2 years ago

5.1.0

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.2.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

4.1.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.2

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.10

2 years ago

0.7.9

2 years ago

0.7.8

2 years ago

0.7.7

2 years ago

0.7.6

2 years ago

0.7.5

2 years ago

0.7.4

2 years ago

0.7.3

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.4

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago