Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Feranchz committed May 17, 2023
1 parent ce18e78 commit c0e6eef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
Expand Up @@ -29,7 +29,7 @@ export function ComponentIcon({ showBackground = true, size = 'M', icon }) {
size={size}
showBackground={showBackground}
>
<Icon as={Icons[icon] || Icons['Cube']} />
<Icon as={Icons[icon] || Icons.Cube} />
</Wrapper>
);
}
Expand Down
Expand Up @@ -62,6 +62,7 @@ export default function ComponentCard({ children, onClick, icon }) {

ComponentCard.defaultProps = {
onClick() {},
icon: 'Cube',
};

ComponentCard.propTypes = {
Expand Down
Expand Up @@ -23,7 +23,7 @@ export function ComponentIcon({ isActive, icon }) {
background={isActive ? 'primary200' : 'neutral200'}
justifyContent="center"
>
<Icon as={Icons[icon] || Icons['Cube']} />
<Icon as={Icons[icon] || Icons.Cube} />
</Wrapper>
);
}
Expand Down
Expand Up @@ -15,6 +15,7 @@ import {
import * as Icons from '@strapi/icons';
import { useIntl } from 'react-intl';
import styled from 'styled-components';
import PropTypes from 'prop-types';
import { getTrad } from '../../utils';

const EXCLUDE_ICONS = [
Expand Down Expand Up @@ -83,6 +84,14 @@ const IconPick = ({ iconKey, name, onChange, isSelected, ariaLabel }) => {
);
};

IconPick.propTypes = {
iconKey: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
isSelected: PropTypes.bool.isRequired,
ariaLabel: PropTypes.string.isRequired,
};

const IconPicker = ({ intlLabel, name, onChange, value }) => {
const { formatMessage } = useIntl();
const [showSearch, setShowSearch] = useState(false);
Expand All @@ -91,9 +100,6 @@ const IconPicker = ({ intlLabel, name, onChange, value }) => {
const [icons, setIcons] = useState(allIcons);
const searchIconRef = useRef(null);

const SearchIcon = Icons['Search'];
const TrashIcon = Icons['Trash'];

const toggleSearch = () => {
setShowSearch(!showSearch);
};
Expand Down Expand Up @@ -154,7 +160,7 @@ const IconPicker = ({ intlLabel, name, onChange, value }) => {
id: getTrad('IconPicker.search.button.label'),
defaultMessage: 'Search icon button',
})}
icon={<SearchIcon />}
icon={<Icons.Search />}
noBorder
/>
)}
Expand All @@ -165,7 +171,7 @@ const IconPicker = ({ intlLabel, name, onChange, value }) => {
id: getTrad('IconPicker.remove.label'),
defaultMessage: 'Remove the selected icon',
})}
icon={<TrashIcon />}
icon={<Icons.Trash />}
noBorder
/>
)}
Expand Down Expand Up @@ -214,4 +220,15 @@ const IconPicker = ({ intlLabel, name, onChange, value }) => {
);
};

IconPicker.defaultProps = {
value: '',
};

IconPicker.propTypes = {
intlLabel: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
value: PropTypes.string,
};

export default IconPicker;

0 comments on commit c0e6eef

Please sign in to comment.