import React, { useState } from 'react'; import { useHistory } from 'react-router-dom'; import ConfigureSnapPopup, { ConfigureSnapPopupType, } from '../../../components/app/configure-snap-popup'; import { ButtonVariant, Box, Button, Icon, IconName, Text, } from '../../../components/component-library'; import { AlignItems, BackgroundColor, BorderColor, BorderRadius, TextColor, Display, FlexDirection, IconColor, JustifyContent, TextVariant, } from '../../../helpers/constants/design-system'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { SnapCardProps } from '../new-snap-account-page/new-snap-account-page'; export default function SnapCard({ iconUrl, snapTitle, snapSlug, isInstalled, website, id, onClickFunc, }: Pick< SnapCardProps, 'iconUrl' | 'snapTitle' | 'snapSlug' | 'isInstalled' | 'website' | 'id' > & { onClickFunc: () => void }) { const t = useI18nContext(); const history = useHistory(); const [showConfigPopover, setShowConfigPopover] = useState(false); return ( {iconUrl ? ( ) : ( // This is the fallback icon based on the first letter of the snap name. {snapTitle ? snapTitle[0] : '?'} )} {isInstalled ? ( ) : ( )} {snapTitle} {snapSlug} setShowConfigPopover(false)} link={website} /> ); }