From 9065eadfa89ed2e50030f2669b5ce550dbb27d3c Mon Sep 17 00:00:00 2001 From: Jean-Marc Millet Date: Thu, 18 Jan 2024 15:45:21 +0100 Subject: [PATCH 1/4] rework of Readme --- README.md | 269 +++++++++++++++++++++++------------------------------- 1 file changed, 115 insertions(+), 154 deletions(-) diff --git a/README.md b/README.md index 9a1ab52e78..6932226887 100755 --- a/README.md +++ b/README.md @@ -1,210 +1,171 @@ -# Welcome to Scality core-ui +# Welcome to Scality Core-UI -This project is a React stateless components library containing all common React components, [Styled-components](https://www.styled-components.com/)' components, layouts, icons and themes for all Scality UI projects. +Core-UI is a component library containing all components, layouts, icons and themes used for all Scality UI projects. \ +This project is built with [React](https://react.dev/) and [TypeScript](https://www.typescriptlang.org/), and styled with [styled-components](https://styled-components.com/). -Components are also themable by using the [styled-components' theming concept](https://www.styled-components.com/docs/advanced). +## Getting started -## What are stateless Components? - -Stateless Components just receive an input as props and return an output as JSX: ```(props) => JSX```. The input, only if available in form of props, shapes the rendered output. These kind of components don't manage state and don't have any side-effects (e.g. accessing the browser's local storage). - -Examples: - -- Stateless/Presentational/Dumb component: -```javascript -const BooksList = ({books}) => { - return ( - - ) -} -``` - -- Stateful/Container/Smart component: -```javascript -import React, { useState, useEffect } from 'react'; - -const BooksList = (props) => { - const [books, setBooks] = useState([]); - useEffect(() => { - setBooks(['Harry Potter', 'Star Wars']); - }, []); - - return ( - - ) -} - -``` - -## How to use it +### Installation - Add ```@scality/core-ui``` in the ```package.json```'s dependencies of your project. + ```json "@scality/core-ui": "github:scality/core-ui.git", ``` - ```@scality/core-ui```requires some peerDependencies below. Make sure that you have them in the ```package.json```'s dependencies. + ```json - "@fortawesome/fontawesome-free": "5.7.2", + "@fortawesome/fontawesome-free": "^5.10.2", + "@fortawesome/fontawesome-svg-core": "^1.2.35", + "@fortawesome/free-regular-svg-icons": "^5.15.3", + "@fortawesome/free-solid-svg-icons": "^5.15.3", + "@fortawesome/react-fontawesome": "^0.1.14", + "@js-temporal/polyfill": "^0.4.4", "polished": "3.4.1", - "react": "^16.8.0", - "react-dom": "^16.8.0", - "react-debounce-input": "3.2.0", - "react-virtualized": "9.21.0", - "react-select": "3.0.3", + "pretty-bytes": "^5.6.0", + "react": "^17.0.2", + "react-debounce-input": "3.2.2", + "react-dom": "^17.0.2", + "react-dropzone": "^14.2.3", + "react-query": "^3.34.0", + "react-router": "^5.2.0", + "react-router-dom": "^5.2.0", + "react-select": "4.3.1", + "react-table": "^7.7.0", + "react-virtualized": "9.22.3", + "react-virtualized-auto-sizer": "^1.0.5", + "react-window": "^1.8.6", "styled-components": "^4.1.2", - "vega": "^5.7.3", + "styled-system": "^5.1.5", + "vega": "^5.17.3", "vega-embed": "^6.0.0", - "vega-lite": "^4.0.0-beta.10" + "vega-lite": "^5.0.0", + "vega-tooltip": "^0.27.0" +``` + +- Install the dependencies : + +```sh +npm install ``` -- Run ```npm install``` to install dependencies +### Usage + +- Import a component from ```@scality/core-ui/dist/next'``` or ```@scality/core-ui``` + +- Use props to change its appearance and behaviour + +```jsx +import { Button } from '@scality/core-ui/dist/next'; +import { Icon } from '@scality/core-ui'; + +