Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New design system applied to priority 1 components #523

Merged
merged 50 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e8918ab
Add new mui-v5 packages + styled-components
VictorVelarde Oct 19, 2022
1f77eb2
Add emotion react & styled libs deps
VictorVelarde Oct 19, 2022
541e9cf
Add automatic codemod replacements, mostly all import changes
VictorVelarde Oct 19, 2022
372890a
Partial and basic typing for new palette elements, using mui
VictorVelarde Oct 19, 2022
a2ea80f
Fully remove material-ui v4 references from lib
VictorVelarde Oct 19, 2022
3290674
Fix import for createSpacing
VictorVelarde Oct 19, 2022
6e495ee
Remove material-ui externals from webpack configuration
VictorVelarde Oct 19, 2022
96d003a
Adapt webpack externals with new peer deps, due to mui v5 upgrade
VictorVelarde Oct 19, 2022
5c2f854
Use custom render with providers in test files for react-ui
VictorVelarde Oct 20, 2022
183a018
Remove custom getMaterialUIContext in favour of render override for t…
VictorVelarde Oct 20, 2022
efc7730
Fix LegendWidgetUI tests, due to some changes in the rendering details
VictorVelarde Oct 20, 2022
ccb6237
Fix FeatureSelectionWidgetUI tests, due to some changes in the render…
VictorVelarde Oct 20, 2022
2dfc0be
Fix RangeWidgetUI tests by changing selectors (temporarily?)
VictorVelarde Oct 21, 2022
fb8ae5a
Remove adaptV4Theme from Storybook preview
VictorVelarde Oct 21, 2022
8307595
Set a new alpha name for experimental release
VictorVelarde Oct 21, 2022
7e38992
Mock requestAnimationFrame in FormulaUI tests
VictorVelarde Oct 21, 2022
8cb9c8d
v0.0.0-experimental-muiv5-0
VictorVelarde Oct 21, 2022
3f39da3
Set peer deps to experimental 0.0.0 packages
VictorVelarde Oct 21, 2022
73b43dc
v0.0.0-experimental-muiv5-1
VictorVelarde Oct 21, 2022
c90ac10
Replace state class names and nested classes selectors with global cl…
vmilan Oct 24, 2022
6568e17
Merge branch 'feature/design-system' into feature/mui5-migration
vmilan Oct 24, 2022
c887477
Merge branch 'feature/design-system' into feature/mui5-migration
vmilan Oct 24, 2022
7165b0f
merge
vmilan Oct 28, 2022
8b4bd50
Merge branch 'feature/design-system' into feature/mui5-migration
vmilan Oct 28, 2022
db52f75
Merge branch 'feature/design-system' into feature/mui5-migration
vmilan Oct 28, 2022
2645e8b
storybook tweaks
vmilan Oct 28, 2022
0b0cdbf
Breaking changes in styles
vmilan Oct 31, 2022
5cadeab
Merge branch 'feature/design-system' into breaking-changes-styles
vmilan Oct 31, 2022
b73923e
components
vmilan Nov 2, 2022
81a7c20
merge
vmilan Nov 2, 2022
c05573f
add status tag in components
vmilan Nov 2, 2022
6ad62c1
button and icon button stories
vmilan Nov 3, 2022
3a4e932
button and icon button styles
vmilan Nov 3, 2022
1489ca6
Icon button
vmilan Nov 4, 2022
059166b
atomic design reorg
vmilan Nov 4, 2022
1f8f55d
Icon button
vmilan Nov 4, 2022
bed2072
New text button component
vmilan Nov 4, 2022
3da3fcd
styles
vmilan Nov 4, 2022
32f19de
add CssBaseline to Storybook ThemeProvider
vmilan Nov 4, 2022
5c47bd8
Button pairing styles
vmilan Nov 7, 2022
8c82851
simplify some colors
vmilan Nov 7, 2022
7842ed2
button group styles
vmilan Nov 7, 2022
bf60e09
fab button
vmilan Nov 7, 2022
1eac14c
fab button
vmilan Nov 8, 2022
56e6d26
fab button
vmilan Nov 8, 2022
1f0ca2e
upgrade notes
vmilan Nov 8, 2022
3911cee
merge
vmilan Nov 8, 2022
45f5ec3
fix test
vmilan Nov 8, 2022
177295e
buttons review
vmilan Nov 8, 2022
183446e
clean up
vmilan Nov 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Not released

- New design system in priority 1 components [#523](https://github.com/CartoDB/carto-react/pull/523)
- Breaking changes in Mui v5: components [#518](https://github.com/CartoDB/carto-react/pull/518)
- Breaking changes in Mui v5: styles and theme [#514](https://github.com/CartoDB/carto-react/pull/514/)
- Add final Figma links into Storybook [#515](https://github.com/CartoDB/carto-react/pull/515)
Expand Down
19 changes: 15 additions & 4 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Upgrade to the new design system

## Breaking changes in Mui v5
# Breaking changes in Mui v5

Please, follow the Mui guides related to breaking changes in components and styles:

- [Styles](https://mui.com/material-ui/migration/v5-style-changes/)
- [Components](https://mui.com/material-ui/migration/v5-component-changes/)

## MUI theme
# MUI theme

[carto-theme.js](https://github.com/CartoDB/carto-react/blob/master/packages/react-ui/src/theme/carto-theme.js) file splitted in sections:

Expand Down Expand Up @@ -36,7 +36,7 @@ Added a few custom variants to the typography set:
- code2
- code3

`Open Sans` and `Montserrat` families have been replaced by `Inter` and `Overpass Mono`, you have an example of this in the [`preview-head.html`](https://github.com/CartoDB/carto-react/blob/master/packages/react-ui/storybook/.storybook/preview-head.html) file.
For external use: `Open Sans` and `Montserrat` families have been replaced by `Inter` and `Overpass Mono`, you have an example of this in the [`preview-head.html`](https://github.com/CartoDB/carto-react/blob/master/packages/react-ui/storybook/.storybook/preview-head.html) file.

We have a `Typography` component that uses `Mui Typography` and extends it with some useful props:

Expand All @@ -48,7 +48,7 @@ This way we can be more flexible regarding text styles without adding too many v
In short, instead of Mui Typography, the component you should use to add text is this one:
`react-ui/src/atoms/Typography`

So `import { Typography } from '@carto/react-ui';`.
For external use: `import { Typography } from '@carto/react-ui';`.

## Colors

Expand Down Expand Up @@ -93,3 +93,14 @@ Use: `borderRadius: theme.spacing(x)`
Design is restringed to a few specific values for shadows, which are:

`0, 1, 2, 4, 6, 8, 16, 24`.

# Components

## Button

We have a `Button` component that uses `Mui Button` and wraps its children in `Typography` to meet with the designed behavior (text overflow case).

So, instead of Mui Button, the component you should use to create buttons is this one:
`react-ui/src/atoms/Button`

For external use: `import { Button } from '@carto/react-ui';`.
2 changes: 1 addition & 1 deletion packages/react-ui/__tests__/widgets/LegendWidgetUI.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Typography from '../../src/atoms/Typography';
import Typography from '../../src/components/atoms/Typography';
import LegendWidgetUI from '../../src/widgets/legend/LegendWidgetUI';
import { fireEvent, render, screen } from '../widgets/utils/testUtils';

Expand Down
1 change: 1 addition & 0 deletions packages/react-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@storybook/addon-essentials": "^6.5.12",
"@storybook/addon-links": "^6.5.12",
"@storybook/addon-viewport": "^6.5.12",
"@etchteam/storybook-addon-status": "^4.2.2",
"@storybook/react": "^6.5.12",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
Expand Down
23 changes: 23 additions & 0 deletions packages/react-ui/src/components/atoms/Button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import { Button as MuiButton } from '@mui/material';
import Typography from './Typography';

const Button = forwardRef(({ style, children, ...otherProps }, ref) => {
// forwardRef needed to be able to hold a reference, in this way it can be a child for some Mui components, like Tooltip
// https://mui.com/material-ui/guides/composition/#caveat-with-refs

return (
<MuiButton {...otherProps} ref={ref} style={style}>
<Typography variant='inherit' color='inherit' noWrap component='span'>
{children}
</Typography>
</MuiButton>
);
});

Button.propTypes = {
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array])
};

export default Button;
6 changes: 4 additions & 2 deletions packages/react-ui/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { CHART_TYPES } from './widgets/TimeSeriesWidgetUI/utils/constants';
import TableWidgetUI from './widgets/TableWidgetUI/TableWidgetUI';
import NoDataAlert from './widgets/NoDataAlert';
import FeatureSelectionWidgetUI from './widgets/FeatureSelectionWidgetUI';
import Typography from './atoms/Typography';
import Typography from './components/atoms/Typography';
import Button from './components/atoms/Button';

export {
theme,
Expand Down Expand Up @@ -50,5 +51,6 @@ export {
LegendIcon,
LegendProportion,
LegendRamp,
Typography
Typography,
Button
};
6 changes: 4 additions & 2 deletions packages/react-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import PolygonIcon from './assets/PolygonIcon';
import RectangleIcon from './assets/RectangleIcon';
import LassoIcon from './assets/LassoIcon';
import CircleIcon from './assets/CircleIcon';
import Typography from './atoms/Typography';
import Typography from './components/atoms/Typography';
import Button from './components/atoms/Button';

const featureSelectionIcons = {
CursorIcon,
Expand Down Expand Up @@ -55,5 +56,6 @@ export {
LegendIcon,
LegendProportion,
LegendRamp,
Typography
Typography,
Button
};
8 changes: 7 additions & 1 deletion packages/react-ui/src/theme/carto-theme.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Theme, ThemeOptions, TypeText } from '@mui/material';
import { Palette, PaletteColor } from '@mui/material';


export const cartoThemeOptions: ThemeOptions;
export const theme: CartoTheme;

Expand Down Expand Up @@ -123,3 +122,10 @@ declare module '@mui/material/Typography' {
code3: true;
}
}

// Update the Buttons's color prop options
declare module '@mui/material/Button' {
interface ButtonPropsColorOverrides {
default: true;
}
}
Loading