0.0.54 • Published 2 months ago

ad-mui-theme-package v0.0.54

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

New theme and design token

This new theme is designed to have different mode (ade, esd, esp, eac...)

Installation

How to start the project

How to use it

How to deploy package to npm

Installation

With yarn

$ yarn add ad-mui-theme-package @mui/material @emotion/react @emotion/styled

With npm

$ npm install ad-mui-theme-package @mui/material @emotion/react @emotion/styled

How to start

$ make start-storybook

This command build package and install dependencies for storybook. Then it launch storybook on port 6006.

How to use it

Import theme in your app

To use the theme you need to import the provider and wrap your app with it.

import { CustomThemeProvider } from "ad-mui-theme-package";

const App = () => {
  return (
    <CustomThemeProvider mode="ade">
      <div>My app</div>
    </CustomThemeProvider>
  );
};

Theme you can use with this package

ADE | ESP

Use the theme in your component

To use the theme in your component mui component

// import mui component
import { Button } from "@mui/material";

const MyComponent = () => {
  // use theme here
  return <Button color="primary">My component</Button>;
};

Use the theme in your component with sx

To use the theme in your component with sx

// import mui component
import { Button } from "@mui/material";

const MyComponent = () => {
  return (
    <Button
      sx={{
        // use theme here
        color: "primary",
      }}
    >
      My component
    </Button>
  );
};

Use the theme in sx with useTheme

To use the theme in your component you need to import the hook useTheme and use it.

// import useTheme from mui
import { useTheme } from "@mui/material";

const MyComponent = () => {
  // create theme const for use it
  const theme = useTheme();

  return (
    <Box
      sx={{
        // use theme here
        backgroundColor: theme.palette.primary.main,
      }}
    >
      My component
    </Box>
  );
};

Use the theme in sx with useTheme and callback

To use the theme in your component you need to import the hook useTheme and use it.

// import useTheme from mui
import { Theme, useTheme } from "@mui/material";

const MyComponent = () => {
  // create theme const for use it
  const theme = useTheme();

  // use theme here
  // type your theme with mui type
  return (
    <Box
      sx={{
        backgroundColor: (theme: Theme) => theme.palette.primary.main,
      }}
    >
      My component
    </Box>
  );
};

StyledTabs & StyledTab

Components StyledTabs & StyledTab doesn't exist now use Tabs & Tab from @mui/material and it's automatically styled with the theme.

Input phone disabled

If you want to disable the input phone you need to add className disabled and disabled properties to the component PhoneInput.

const CustomInputPhone = ({ ...rest }: PhoneInputProps) => {
  return (
    <>
      <Grid container spacing={2}>
        <InputLabel>
          <Label field={field} />
        </InputLabel>
        <PhoneInput containerClass={"disabled"} disabled={true} {...rest} />
      </Grid>
    </>
  );
};

export default CustomInputPhone;

Custom IconButton

If you want to use custom IconButton you need to import IconButton from @mui/material and add variant props. You can use all color from the theme but you need to add -contained, -outlined, -soft or -ghost at the end of the color.

import { IconButton } from "@mui/material";

const MyComponent = () => {
  return (
    <IconButton variant="primary-contained">
      <Icon />
    </IconButton>
  );
};

How to deploy

Run the following commands to deploy the package to npm.

These commands trigger a workflow that will build the package, publish it to npm, and create a new Github version.

⚠️ The new version takes the version of the tag so be careful, the tag of the new version must be greater than the last published version. Otherwise, the workflow will fail. ⚠️

$ git add <files>
$ git commit -m "<message>"
$ git push
$ git tag <newVersion>
$ git push --tags
0.0.54

2 months ago

0.0.53

4 months ago

0.0.52

4 months ago

0.0.51

4 months ago

0.0.50

4 months ago

0.0.49

5 months ago

0.0.48

5 months ago

0.0.40

6 months ago

0.0.41

6 months ago

0.0.42

6 months ago

0.0.20

8 months ago

0.0.43

6 months ago

0.0.21

8 months ago

0.0.44

6 months ago

0.0.22

8 months ago

0.0.45

6 months ago

0.0.23

8 months ago

0.0.46

6 months ago

0.0.24

8 months ago

0.0.47

6 months ago

0.0.25

8 months ago

0.0.37

7 months ago

0.0.15

10 months ago

0.0.38

7 months ago

0.0.16

8 months ago

0.0.39

6 months ago

0.0.17

8 months ago

0.0.18

8 months ago

0.0.19

8 months ago

0.0.31

7 months ago

0.0.32

7 months ago

0.0.10

10 months ago

0.0.33

7 months ago

0.0.11

10 months ago

0.0.34

7 months ago

0.0.12

10 months ago

0.0.35

7 months ago

0.0.13

10 months ago

0.0.36

7 months ago

0.0.14

10 months ago

0.0.3

10 months ago

0.0.26

8 months ago

0.0.9

10 months ago

0.0.27

7 months ago

0.0.8

10 months ago

0.0.28

7 months ago

0.0.29

7 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.2

11 months ago

0.0.1

11 months ago