import classNames from 'classnames'; import { type ChangeEventHandler, type FocusEventHandler, type FunctionComponent, type KeyboardEventHandler, memo, type MouseEventHandler, type Ref, type TouchEventHandler, } from 'react'; import ExclamationSquareFill from '@/icons/ExclamationSquareFill.svg'; import styles from './Tile.module.scss'; interface Props { 'aria-label': string; autoFocus?: boolean; canShowPoints?: boolean; character?: string; className?: string; disabled?: boolean; highlighted?: boolean; inputRef: Ref; isBlank?: boolean; isValid?: boolean; placeholder?: string; points?: number; pointsFormatted?: string; raised?: boolean; tabIndex?: number; onChange?: ChangeEventHandler; onFocus?: FocusEventHandler; onKeyDown?: KeyboardEventHandler; onMouseDown?: MouseEventHandler; onTouchStart?: TouchEventHandler; } const TilePureBase: FunctionComponent = ({ 'aria-label': ariaLabel, autoFocus, canShowPoints, character, className, disabled, highlighted, inputRef, isBlank, isValid, placeholder, points, pointsFormatted, raised, tabIndex, onChange, onFocus, onKeyDown, onMouseDown, onTouchStart, }) => (
= 5, [styles.raised]: raised, })} role={highlighted ? 'mark' : undefined} > {character || placeholder} {!disabled && ( )} {canShowPoints && {pointsFormatted}} {!isValid &&
); export const TilePure = memo(TilePureBase);