Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Update deprecated material-ui method (#146)
Browse files Browse the repository at this point in the history
* Bump material-ui and replace deprecated method

* Bump minor dependencies and cleanup

* Use void function to onMouseLeave as we don't need the return value

* Set v0.8.0

* Remove classnames direct dependency
  • Loading branch information
Daniel Sanchez authored Aug 19, 2021
1 parent 6fcdf7a commit bf42522
Show file tree
Hide file tree
Showing 11 changed files with 1,188 additions and 1,068 deletions.
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-react-components",
"version": "0.7.0",
"version": "0.8.0",
"description": "Gnosis UI components",
"main": "dist/index.min.js",
"typings": "dist/index.d.ts",
Expand All @@ -24,15 +24,14 @@
"author": "Gnosis (https://gnosis.pm)",
"license": "MIT",
"dependencies": {
"classnames": "^2.2.6",
"react-media": "^1.10.0"
},
"devDependencies": {
"@babel/core": "^7.14.0",
"@babel/preset-env": "^7.14.0",
"@babel/preset-react": "^7.14.0",
"@babel/preset-typescript": "^7.14.0",
"@material-ui/core": "^4.11.2",
"@material-ui/core": "^4.12.3",
"@storybook/addon-actions": "^6.3.0",
"@storybook/addon-docs": "^6.3.0",
"@storybook/addon-links": "^6.3.0",
Expand All @@ -42,18 +41,17 @@
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.2.0",
"@types/classnames": "^2.2.11",
"@types/jest": "^26.0.0",
"@types/material-ui": "^0.21.9",
"@types/node": "^14.14.0",
"@types/node": "^16.6.1",
"@types/react": "^16.9.55",
"@types/react-dom": "^16.9.0",
"@types/styled-components": "^5.1.11",
"@typescript-eslint/eslint-plugin": "^4.28.4",
"@typescript-eslint/parser": "^4.28.4",
"@types/styled-components": "^5.1.12",
"@typescript-eslint/eslint-plugin": "^4.29.2",
"@typescript-eslint/parser": "^4.29.2",
"awesome-typescript-loader": "^5.2.1",
"copy-webpack-plugin": "^6.3.0",
"eslint": "^7.31.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
Expand All @@ -68,7 +66,7 @@
"react-docgen-typescript-loader": "^3.7.2",
"react-dom": "^16.14.0",
"rimraf": "^3.0.2",
"styled-components": "^5.2.1",
"styled-components": "^5.3.0",
"typescript": "^4.0.5",
"url-loader": "^4.1.1",
"webpack": "4.43.0",
Expand Down
4 changes: 2 additions & 2 deletions src/dataDisplay/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import styled from 'styled-components';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { alpha } from '@material-ui/core/styles';

const StyledCard = styled.div`
box-shadow: 1px 2px 10px 0
${({ theme }) => fade(theme.colors.shadow.color, 0.18)};
${({ theme }) => alpha(theme.colors.shadow.color, 0.18)};
border-radius: 8px;
padding: 24px;
background-color: ${({ theme }) => theme.colors.white};
Expand Down
4 changes: 2 additions & 2 deletions src/dataDisplay/FixedDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { alpha } from '@material-ui/core/styles';

import { Title, ModalFooterConfirmation } from '../../index';

Expand All @@ -16,7 +16,7 @@ const Wrapper = styled.div`
background-color: ${({ theme }) => theme.colors.white};
border-radius: 8px;
box-shadow: 1px 2px 10px 0
${({ theme }) => fade(theme.colors.shadow.color, 0.18)};
${({ theme }) => alpha(theme.colors.shadow.color, 0.18)};
'&:focus': {
outline: 'none';
Expand Down
5 changes: 2 additions & 3 deletions src/dataDisplay/Text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import styled from 'styled-components';
import Tooltip from '@material-ui/core/Tooltip';
import { withStyles } from '@material-ui/core/styles';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { withStyles, alpha } from '@material-ui/core/styles';

import theme, { ThemeTextSize, ThemeColors } from '../../theme';

Expand Down Expand Up @@ -32,7 +31,7 @@ const StyledTooltip = withStyles(() => ({
tooltip: {
backgroundColor: theme.colors.white,
color: theme.colors.text,
boxShadow: `0px 0px 10px ${fade(theme.colors.shadow.color, 0.2)}`,
boxShadow: `0px 0px 10px ${alpha(theme.colors.shadow.color, 0.2)}`,
},
arrow: {
color: theme.colors.white,
Expand Down
7 changes: 3 additions & 4 deletions src/dataDisplay/Tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React, { ReactElement } from 'react';
import MUITooltip, {
TooltipProps as TooltipPropsMui,
} from '@material-ui/core/Tooltip';
import { withStyles } from '@material-ui/core/styles';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { withStyles, alpha } from '@material-ui/core/styles';

import theme, { ThemeColors, ThemeTooltipSize } from '../../theme';

Expand Down Expand Up @@ -60,7 +59,7 @@ const customTooltip = ({
backgroundColor: backgroundColor
? (theme.colors[backgroundColor] as string)
: theme.colors.overlay.color,
boxShadow: `1px 2px 10px ${fade(theme.colors.shadow.color, 0.18)}`,
boxShadow: `1px 2px 10px ${alpha(theme.colors.shadow.color, 0.18)}`,
border: getBorderBySize(size),
color: textColor
? (theme.colors[textColor] as string)
Expand All @@ -78,7 +77,7 @@ const customTooltip = ({
border: 'none',

'&::before': {
boxShadow: `1px 2px 10px ${fade(theme.colors.shadow.color, 0.18)}`,
boxShadow: `1px 2px 10px ${alpha(theme.colors.shadow.color, 0.18)}`,
},
},
}))(MUITooltip);
Expand Down
8 changes: 4 additions & 4 deletions src/inputs/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement, ReactNode, HTMLAttributes } from 'react';
import ButtonMUI, {
ButtonProps as ButtonMUIProps,
} from '@material-ui/core/Button';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { alpha } from '@material-ui/core/styles';

import styled, {
css,
Expand Down Expand Up @@ -55,7 +55,7 @@ const customStyles: {
contained: css`
color: ${({ theme }) => theme.colors.white};
background-color: ${({ theme }) => theme.colors.primary};
box-shadow: 1px 2px 10px ${fade(theme.colors.shadow.color, 0.18)};
box-shadow: 1px 2px 10px ${alpha(theme.colors.shadow.color, 0.18)};
&:hover {
background-color: ${({ theme }) => theme.colors.primaryHover};
Expand Down Expand Up @@ -106,7 +106,7 @@ const customStyles: {
contained: css`
color: ${({ theme }) => theme.colors.white};
background-color: ${({ theme }) => theme.colors.secondary};
box-shadow: 1px 2px 10px ${fade(theme.colors.shadow.color, 0.18)};
box-shadow: 1px 2px 10px ${alpha(theme.colors.shadow.color, 0.18)};
path.icon-color {
color: ${({ theme }) => theme.colors.white};
Expand Down Expand Up @@ -164,7 +164,7 @@ const customStyles: {
contained: css`
color: ${({ theme }) => theme.colors.white};
background-color: ${({ theme }) => theme.colors.error};
box-shadow: 1px 2px 10px ${fade(theme.colors.shadow.color, 0.18)};
box-shadow: 1px 2px 10px ${alpha(theme.colors.shadow.color, 0.18)};
&:hover {
background-color: ${({ theme }) => theme.colors.errorHover};
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/Switch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import SwitchMui from '@material-ui/core/Switch';
import styled from 'styled-components';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { alpha } from '@material-ui/core/styles';

const StyledSwitch = styled(({ ...rest }) => <SwitchMui {...rest} />)`
&& {
Expand All @@ -12,7 +12,7 @@ const StyledSwitch = styled(({ ...rest }) => <SwitchMui {...rest} />)`
}
.MuiSwitch-colorSecondary.Mui-checked:hover {
background-color: ${({ theme }) => fade(theme.colors.primary, 0.08)};
background-color: ${({ theme }) => alpha(theme.colors.primary, 0.08)};
}
.Mui-checked + .MuiSwitch-track {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/CopyToClipboardBtn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ const CopyToClipboardBtn = ({
copy();
};

const onButtonBlur = (): number =>
const onButtonBlur = (): void => {
setTimeout((): void => setClicked(false), 300);
};

return (
<StyledButton
Expand Down
7 changes: 3 additions & 4 deletions src/utils/modals/GenericModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from 'react';
import Modal from '@material-ui/core/Modal';
import { makeStyles } from '@material-ui/core/styles';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { alpha } from '@material-ui/core/styles';
import styled from 'styled-components';
import cn from 'classnames';
import Media from 'react-media';

import theme from '../../../theme';
Expand Down Expand Up @@ -66,7 +65,7 @@ const useStyles = makeStyles({
alignItems: 'center',
justifyContent: 'center',
overflowY: 'scroll',
background: fade(theme.colors.overlay.color, theme.colors.overlay.opacity),
background: alpha(theme.colors.overlay.color, theme.colors.overlay.opacity),
},

paper: {
Expand Down Expand Up @@ -99,7 +98,7 @@ const GenericModal = ({

return (
<Modal open className={classes.modal}>
<div className={cn(classes.paper)}>
<div className={classes.paper}>
<TitleSection>
<Title size="xs" withoutMargin>
{title}
Expand Down
16 changes: 8 additions & 8 deletions tests/__snapshots__/storybook.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ exports[`Storyshots Data Display/Accordion Compact Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -330,7 +330,7 @@ exports[`Storyshots Data Display/Accordion Compact Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -460,7 +460,7 @@ exports[`Storyshots Data Display/Accordion Compact Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -694,7 +694,7 @@ exports[`Storyshots Data Display/Accordion Simple Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -824,7 +824,7 @@ exports[`Storyshots Data Display/Accordion Simple Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -954,7 +954,7 @@ exports[`Storyshots Data Display/Accordion Simple Accordion 1`] = `
</div>
</div>
<div
className="MuiCollapse-container MuiCollapse-hidden"
className="MuiCollapse-root MuiCollapse-hidden"
style={
Object {
"minHeight": "0px",
Expand Down Expand Up @@ -11934,7 +11934,7 @@ exports[`Storyshots Inputs/TextField End Adornment 1`] = `
value=""
/>
<div
className="MuiInputAdornment-root MuiInputAdornment-filled MuiInputAdornment-positionEnd"
className="MuiInputAdornment-root MuiInputAdornment-positionEnd MuiInputAdornment-filled"
>
<span
className="c1"
Expand Down Expand Up @@ -12268,7 +12268,7 @@ exports[`Storyshots Inputs/TextField Start Adornment 1`] = `
onClick={[Function]}
>
<div
className="MuiInputAdornment-root MuiInputAdornment-filled MuiInputAdornment-positionStart"
className="MuiInputAdornment-root MuiInputAdornment-positionStart MuiInputAdornment-filled"
>
<span
className="c1"
Expand Down
Loading

0 comments on commit bf42522

Please sign in to comment.