Skip to content
Snippets Groups Projects
Commit 9a3776ba authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Fix default icon

parent abb8ca78
Branches
Tags
1 merge request!291Fix/design adjustments
...@@ -20,16 +20,12 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({ ...@@ -20,16 +20,12 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({
const handleCardclick = () => { const handleCardclick = () => {
handleClick && ecogesture && handleClick(ecogesture) handleClick && ecogesture && handleClick(ecogesture)
} }
const [ecogestureIcon, setEcogestureIcon] = useState<string>() const [ecogestureIcon, setEcogestureIcon] = useState<string>('')
useEffect(() => { useEffect(() => {
if (ecogesture) { if (ecogesture) {
importIconbyId(ecogesture.id, 'ecogesture').then(icon => { importIconbyId(ecogesture.id, 'ecogesture').then(icon => {
if (icon) { icon ? setEcogestureIcon(icon) : setEcogestureIcon(defaultIcon)
setEcogestureIcon(icon)
} else {
setEcogestureIcon(defaultIcon)
}
}) })
} }
}, [ecogesture]) }, [ecogesture])
...@@ -40,13 +36,7 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({ ...@@ -40,13 +36,7 @@ const EcogestureCard: React.FC<EcogestureCardProps> = ({
<div className="ec"> <div className="ec">
<div className={`ec-content `}> <div className={`ec-content `}>
<div className="ec-content-icon"> <div className="ec-content-icon">
{ecogestureIcon && ( <StyledIcon className="Icon" icon={ecogestureIcon} size={50} />
<StyledIcon
className="Icon"
icon={ecogestureIcon || ''}
size={50}
/>
)}
</div> </div>
<div className="ec-content-short-name text-15-bold"> <div className="ec-content-short-name text-15-bold">
{ecogesture.shortName} {ecogesture.shortName}
......
...@@ -14,6 +14,8 @@ import { useSelector } from 'react-redux' ...@@ -14,6 +14,8 @@ import { useSelector } from 'react-redux'
import MuiButton from '@material-ui/core/Button' import MuiButton from '@material-ui/core/Button'
import EfficientyRating from './EfficientyRating' import EfficientyRating from './EfficientyRating'
import classNames from 'classnames' import classNames from 'classnames'
import defaultIcon from 'assets/icons/visu/ecogesture/default.svg'
interface EcogestureModalProps { interface EcogestureModalProps {
ecogesture: Ecogesture ecogesture: Ecogesture
isAction: boolean isAction: boolean
...@@ -41,7 +43,7 @@ const EcogestureModal: React.FC<EcogestureModalProps> = ({ ...@@ -41,7 +43,7 @@ const EcogestureModal: React.FC<EcogestureModalProps> = ({
useEffect(() => { useEffect(() => {
if (ecogesture) { if (ecogesture) {
importIconbyId(ecogesture.id, 'ecogesture').then(icon => { importIconbyId(ecogesture.id, 'ecogesture').then(icon => {
icon && setEcogestureIcon(icon) icon ? setEcogestureIcon(icon) : setEcogestureIcon(defaultIcon)
}) })
if ( if (
currentChallenge && currentChallenge &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment