import * as React from 'react'; import Icon from './Icon'; const COMMON_LIST_ELEM_CLASSES = ` w-full p-2 text-xl font-light border-inherit group-focus-within:border-slate-300 `; interface PropTypes { value: string; subtext?: string; thumb?: string; isLast: boolean; selected: boolean; href?: string; style: 'item' | 'info' | 'error'; domainIcon?: string; } export default function ListItem({ value, thumb, isLast, selected, style, href, subtext, domainIcon, }: PropTypes) { const groupHoverClassName = 'group-hover:text-slate-200'; const iconClassName = ['ml-2']; const textClassName = [ COMMON_LIST_ELEM_CLASSES, 'group flex items-center justify-between', isLast && 'rounded-b-lg', style === 'item' && selected && 'bg-slate-700 text-slate-100', style === 'info' && 'text-slate-500 italic', style === 'error' && 'text-red-500', 'hover:bg-slate-600 hover:text-slate-200', ].filter(Boolean); return ( { if (href) { window.location.href = href; } }} href={href} > {style === 'error' && ( )}
{thumb && ( thumbnail )}
{value}
{subtext && (
{subtext}
)} {domainIcon && ( domain icon )}
); }