GithubHelp home page GithubHelp logo

tchak / react-dsfr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dataesr/react-dsfr

0.0 0.0 0.0 26.63 MB

Non-official React components of the official french Système de Design de l'État.

License: MIT License

JavaScript 95.88% HTML 0.48% CSS 3.65%

react-dsfr's Introduction

@dataesr/react-dsfr

NPM JavaScript Style Guide GitHub contributors

Build & Test GitHub last commit

Non-official React components of the official french Système de Design de l'État.

Current version is using @gouvfr/[email protected]

Requirements

  • node >= 14.1x
  • npm >= 6.1x
  • React >= 17.0.x

Installation

yarn add @dataesr/react-dsfr

or

npm install @dataesr/react-dsfr

Library usage

Styleguide

Styleguide gives you access to the list of props needed and a working example for each component available in the library. To launch it on your local machine:

npm run guide

Visit http://localhost:6060.

The complete styleguide is available online https://dataesr.github.io/react-dsfr/.

Npm package

Generate /dist folder containing bundles

Rollupjs is used to bundle files. cf config in rollup.config.js

npm run build

Generate and watch /dist folder containing bundles

npm install
npm start

⚠️ Header component is mandatory to use @dataesr/react-dsfr

Example page

A playground to test components

An example page is available containing all components. To launch it on your local machine, first launch watcher of the project and then:

cd example
npm install 
npm start

Use Icons

⚠️ CDN link of css must be added to the <head> of your website.

    <link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css" rel="stylesheet">

We are using remixicon.

Use Colors

Color variables are available in style/color.css. To make a new component dark theme compatible it's recommended to use variables from scheme.css in @gouvfr/dsfr project

Some components can be colored with variables (see colorFamily props) listed below:

['green-tilleul-verveine', 'green-bourgeon', 'green-emeraude', 'green-menthe', 'green-archipel', 'blue-ecume', 'blue-cumulus', 'purple-glycine', 'pink-macaron', 'pink-tuile', 'yellow-tournesol', 'yellow-moutarde', 'orange-terre-battue', 'brown-cafe-creme', 'brown-caramel', 'brown-opera', 'beige-gris-galet']

Publish it on npm registry

First update the version number in package.json

npm i --package-lock-only
npm login
npm publish --tag latest --access public

Visit http://localhost:3000.

Test your node module before you publish

npm link @dataesr/react-dsfr

Help from outside

Thanks to the internet world.

Unit tests

Run all tests using react-scripts with watcher option

npm run test:dev

Accessibility

Components can be tested in Example's page App.js with @axe-core/react

npm install --save-dev @axe-core/react

Another solution to test accessibility is CLI module https://pa11y.org/

Check configuration file .pa11y-ci

npm install -g pa11y-ci
pa11y-ci

In Chrome

npm run test:debug

Access about:inspect

See doc debugging-tests

They use react-dsfr and we like it!

TODO

  • To limit usage of colors to colorFamilies
  • Add StoryBook

react-dsfr's People

Contributors

adipasquale avatar annelhote avatar desoindx avatar folland87 avatar jerem1508 avatar poplingue avatar raitobezarius avatar revolunet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.