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

chore(deps-major) Update dependency styled-components to v6 #1103

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@types/react-router-dom": "5.3.3",
"@types/react-window": "1.8.5",
"@types/sanitize-html": "2.9.0",
"@types/styled-components": "5.1.26",
"@types/webpack": "5.28.2",
"@typescript-eslint/eslint-plugin": "6.4.1",
"@typescript-eslint/parser": "6.4.1",
Expand Down Expand Up @@ -117,12 +116,11 @@
"react-router-dom": "6.11.1",
"react-window": "1.8.9",
"sanitize-html": "2.11.0",
"styled-components": "5.3.11",
"styled-components": "6.0.7",
"yarn": "1.22.19",
"yup": "1.2.0"
},
"resolutions": {
"styled-components": "5.3.11",
"@mui/styled-engine": "5.13.2",
"lodash": "4.17.21",
"glob-parent": "6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/components/designSystem/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
localLoading && !icon && !!startIcon ? (
<Icon animation="spin" name="processing" />
) : (
startIcon && <Icon name={startIcon} />
startIcon && <Icon name={startIcon} onClick={() => handleClick} />
)
}
{...mapProperties(variant, !!inheritColor)}
Expand All @@ -182,7 +182,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
localLoading ? (
<Icon animation="spin" name="processing" />
) : (
<Icon name={icon} />
<Icon name={icon} onClick={() => handleClick} />
)
) : (
children
Expand Down
12 changes: 8 additions & 4 deletions src/components/designSystem/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cloneElement } from 'react'
import { Box } from '@mui/material'
import styled from 'styled-components'
import clsns from 'classnames'

Expand Down Expand Up @@ -76,20 +76,24 @@ export const Icon = ({
const SVGIcon = ALL_ICONS[name]

return (
<StyledIcon
<StyledBox
title={`${name}/${size}`}
data-test={`${name}/${size}`}
$size={size}
$canClick={!!onClick}
className={clsns('svg-icon', className, { [`icon-animation--${animation}`]: animation })}
$color={mapColor(color)}
component={<SVGIcon />}
component={SVGIcon}
onClick={onClick}
/>
)
}

const StyledIcon = styled(({ component, ...props }) => cloneElement(component, props))`
const StyledBox = styled(Box)<{
$size: keyof typeof IconSizeEnum
$canClick: boolean
$color: string
}>`
width: ${(props: { $size: keyof typeof IconSizeEnum }) => IconSizeEnum[props.$size]};
min-width: ${(props: { $size: keyof typeof IconSizeEnum }) => IconSizeEnum[props.$size]};
height: ${(props: { $size: keyof typeof IconSizeEnum }) => IconSizeEnum[props.$size]};
Expand Down
Loading
Loading