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

icon migration to ts added #912

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/redux-logger": "^3.0.9",
"@types/styled-components": "^5.1.26",
"@types/styled-system": "^5.1.16",
"@typescript-eslint/eslint-plugin": "5.42.1",
"@typescript-eslint/parser": "5.42.1",
"@vitejs/plugin-react": "1.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import React from 'react'
import styled from 'styled-components'
import PropTypes from 'prop-types'
import { space, typography } from 'styled-system'
import { colors } from '../../theme'

const IconStyled = styled.span`
type TIconStyled = {
size: number
color: string
fill: number
wght: number
grad: number
opsz: number
className: string
}

const IconStyled = styled.span<TIconStyled>`
font-variation-settings: 'FILL' ${(props) => props.fill}, 'wght' ${(props) => props.wght},
'GRAD' ${(props) => props.grad}, 'opsz' ${(props) => props.opsz};
color: ${(props) => props.color};
font-size: ${(props) => props.size}px;
${space}
${typography}
`
type TIcon = {
name: string
} & Partial<TIconStyled>

function Icon({
name,
Expand All @@ -22,7 +35,7 @@ function Icon({
opsz = 48,
className = '',
...props
}) {
}: TIcon) {
return (
<IconStyled
className={`material-symbols-outlined ${className}`}
Expand All @@ -39,15 +52,4 @@ function Icon({
)
}

Icon.propTypes = {
name: PropTypes.string.isRequired,
size: PropTypes.number,
color: PropTypes.string,
fill: PropTypes.number,
wght: PropTypes.number,
grad: PropTypes.number,
opsz: PropTypes.number,
className: PropTypes.string,
}

export default styled(Icon)``