Skip to content

Commit

Permalink
fix: lock react-icon version until react-icons/react-icons#940 will…
Browse files Browse the repository at this point in the history
… not be resolved
  • Loading branch information
BADtochka committed May 1, 2024
1 parent 0aa138f commit a9356a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@
},
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs"
"import": "./dist/index.js"
}
},
"dependencies": {
"@storybook/theming": "^8.0.9",
"@tabler/icons-react": "^3.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.1.0"
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "5.1.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.3",
Expand All @@ -49,18 +47,18 @@
"@storybook/react": "^8.0.9",
"@storybook/react-vite": "^8.0.9",
"@storybook/test": "^8.0.9",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-storybook": "^0.8.0",
"lightningcss": "^1.24.1",
"sass": "^1.75.0",
"sass": "^1.76.0",
"storybook": "^8.0.9",
"terser": "^5.31.0",
"typescript": "^5.4.5",
Expand Down
14 changes: 5 additions & 9 deletions src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as evicons from '@components/Icon/icons'
import React, { FC } from 'react'
import { FC } from 'react'
import { IconBaseProps } from 'react-icons'
import * as tbicons from 'react-icons/tb'
import './style.scss'
Expand All @@ -19,19 +19,15 @@ export const IconNames = Object.keys(evicons).concat(Object.keys(tbicons))

export const Icon: FC<IconProps> = ({ name, color = 'currentColor', size = '1.063rem', onClick }) => {

const getParsedIcon = (): React.ElementType | null => {
if (Object.keys(evicons).includes(name)) {
return evicons[name as EveotIconName];
} else {
return tbicons[name as TablerIconName];
}
};
const ParsedIcon = Object.keys(evicons).includes(name) ? evicons[name as EveotIconName] : tbicons[name as TablerIconName]

const ParsedIcon = getParsedIcon();
// const getParsedIcon = (): React.ElementType | null => Object.keys(evicons).includes(name) ? evicons[name as EveotIconName] : tbicons[name as TablerIconName];
// const ParsedIcon = getParsedIcon();

if (!ParsedIcon) {
return <p style={{color: '#F44336'}}>ICON:ERR</p>;
}

return (
<div className="ev-icon" onClick={onClick}>
<ParsedIcon size={size} color={color} />
Expand Down

0 comments on commit a9356a7

Please sign in to comment.