1.4.1 • Published 18 days ago

@pagopa/mui-italia v1.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
18 days ago

MUI Italia

Material-UI theme inspired by Bootstrap Italia.

!important The components of this package are designed for use within an application. To build a landing page, use the pagopa-editorial-components package, which is based on this one.

Installation

To add this package to your package.json run in your terminal:

// with npm
$ npm install @pagopa/mui-italia @mui/material @emotion/react @emotion/styled
// with yarn
$ yarn add @pagopa/mui-italia @mui/material @emotion/react @emotion/styled

Usage

/*
** MainApp.js
*/
[...]
/* MUI Core Components */
import { Button } from '@mui/material';
import { ThemeProvider } from "@mui/material";

/* MUI Italia theme */
import { theme } from "@pagopa/mui-italia";


function App() {
  return (
    <ThemeProvider theme={theme}>
      <div className="App">
        <Button variant="contained">Hello World</Button>
      </div>
    </ThemeProvider>
  );
}

export default App;

Then, use Material-UI as usual. The theme is just a "wrapper" which overrides the default params like: colors, font-family, padding size, etc etc. Try to avoid custom style, try to use all the standard library + this theme.

This package contain also a specific "color" named "Italia", with a "blu italia palette". To use this color in your component use:

[...]
import { italia } from "@pagopa/mui-italia";

<Box
  sx={{
    width: 100,
    height: 100,
    backgroundColor: italia[200],
    borderRadius: theme.spacing(3),
  }}
></Box>

CLI Commands

Here's an explanation of the commands you can find in the package.json:

  • prebuild: Executed automtically before the build command. It removes the dist folder to get a blank state.
  • build: It compiles the entire project using the relative tsconfig.json file. It also resolves all the alias contained in the configuration file.
  • lint: It checks the entire project to detect syntax errors or inefficient code, using the configuration set in the eslintrc.js file.
  • storybook: It launches a local Storybook application using 6006 port.
  • build-storybook: It outputs a static Storybook in the storybook-static folder
  • chromatic: It checks all the possible differences between snapshots using the Chromatic service. It also publishes an updated version of the Storybook-Chromatic library (see address below). This command is just available to the CI/CD environment because you have to specify the project token to run the command successfully. To get the token value in Chromatic: Manage → Configure → Setup Chromatic

Storybook

If you need to view all the styled and custom components available in this package, check out the (ongoing) MUI Italia Storybook (managed with Chromatic).

How to contribute

All components in this package should be generic enough to be used in different applications and use cases. In this sense, if you have any doubts or aren't sure, please ask your fellow designer. With that said, you basically have two options starting from the design project:

Build the generic component (easy abstraction)

  1. Take the time to make a proper analysis of the component's possible props.
  2. Ask your fellow developers/designers for comments or criticism
  3. Build it, according to the provided guidelines (see below)
  4. Test all its possible combinations, using Storybook or similar playground

Provide a sample of how to compose the component (hard abstraction)

  1. Compose the component using the available components provided by the library
  2. Add a specific story to the Storybook, under the Composition section
  3. See the Sidenav as an example of this approach

Either way, you must follow these guidelines:

Visual consistency

  • If possible, avoid magic numbers.
  • Use the provided visual attributes (color, spacing, etc…), using the corresponding theme file
  • If you have to use some values not provided by the theme object:
    • Ask to your fellow designer for clarification
    • If necessary, extend it.

Version control

  • Create a new branch using the relative Jira ticket as prefix, followed by a very concise description of the task. E.g: JIRA-201-add-new-color-values
  • Once you have completed your task, open a PR with a descriptive title preceded by the Jira ticket number. E.g: JIRA-201 Add the new color values for the new A component
  • Please follow the PR template. Don't leave the description blank

Storybook/Chromatic integration

  • New components must have relative Storybook stories.
  • If your contribution involves updates to existing components, ensure that Storybook stories are updated to reflect the changes.
  • The components are responsive by default. To make sure everything is okay, please configure the single story using the breakpointsChromaticValues array in the configuration to make sure Chromatic generates all the required snapshots.
  • To access Chromatic with full privileges, you need to be part of the PagoPA mui-italia-contributors team. Please contact your (technical) project manager for more information.

Accessibility

  • Ensure that the new components are accessible to all users. To avoid reinventing the wheel, take advantage of the MUI base components.
  • Try to perform the actions using only the keyboard.

Cross-Browser Compatibility

  • Test your changes on multiple browsers and ensure they work consistently.

When you feel ready, you can open a pull request.

1.4.1

18 days ago

1.4.0

26 days ago

1.3.0

27 days ago

1.2.0

2 months ago

1.1.0

5 months ago

1.0.2

7 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.9.10

10 months ago

0.9.11

10 months ago

0.11.0

10 months ago

0.9.9

10 months ago

0.10.0

10 months ago

0.9.8

11 months ago

0.9.7

12 months ago

0.9.6

12 months ago

0.9.5

1 year ago

0.9.0

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.9.4

1 year ago

0.9.3

1 year ago

0.8.9

1 year ago

0.8.12

1 year ago

0.8.11

1 year ago

0.8.10

1 year ago

0.8.8

1 year ago

0.8.5

2 years ago

0.8.4

2 years ago

0.8.7

1 year ago

0.8.6

1 year ago

0.8.3

2 years ago

0.7.4

2 years ago

0.7.5

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.8.2

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.3

2 years ago

0.6.29

2 years ago

0.6.28

2 years ago

0.6.27

2 years ago

0.6.26

2 years ago

0.7.0

2 years ago

0.6.32

2 years ago

0.6.31

2 years ago

0.6.34

2 years ago

0.6.33

2 years ago

0.6.30

2 years ago

0.6.39

2 years ago

0.6.36

2 years ago

0.6.35

2 years ago

0.6.38

2 years ago

0.6.37

2 years ago

0.6.21

2 years ago

0.6.20

2 years ago

0.6.23

2 years ago

0.6.22

2 years ago

0.6.25

2 years ago

0.6.24

2 years ago

0.6.18

2 years ago

0.6.17

2 years ago

0.6.19

2 years ago

0.6.16

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.10

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.14

2 years ago

0.6.13

2 years ago

0.6.15

2 years ago

0.6.3

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.2

2 years ago

0.5.3

2 years ago

0.6.1

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago

0.5.1

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago