import {Trans} from '@common/i18n/trans'; import React from 'react'; import {ButtonBase} from '@common/ui/buttons/button-base'; import clsx from 'clsx'; import {IllustratedMessage} from '@common/ui/images/illustrated-message'; import fontImage from './font.svg'; import {SvgImage} from '@common/ui/images/svg-image/svg-image'; import {FontSelectorFilters} from '@common/ui/font-selector/font-selector-filters'; import { FontSelectorState, UseFontSelectorProps, useFontSelectorState, } from '@common/ui/font-selector/font-selector-state'; import {FontSelectorPagination} from '@common/ui/font-selector/font-selector-pagination'; import {FontConfig} from '@common/http/value-lists'; import {Skeleton} from '@common/ui/skeleton/skeleton'; import {AnimatePresence, m} from 'framer-motion'; import {opacityAnimation} from '@common/ui/animation/opacity-animation'; interface FontSelectorProps extends UseFontSelectorProps { className?: string; } export function FontSelector(props: FontSelectorProps) { const state = useFontSelectorState(props); return (
); } interface FontListProps { state: FontSelectorState; } function FontList({state}: FontListProps) { const {isLoading, fonts} = state; const gridClassName = 'grid gap-24 grid-cols-[repeat(auto-fill,minmax(90px,1fr))] items-start'; if (isLoading) { return ; } if (!fonts?.length) { return ( } title={} description={ } /> ); } return ( {fonts?.map(font => ( ))} ); } interface FontButtonProps { font: FontConfig; state: FontSelectorState; } function FontButton({font, state: {value, onChange}}: FontButtonProps) { const isActive = value?.family === font.family; const displayName = font.family.split(',')[0].replace(/"/g, ''); return ( { onChange(font); }} > Aa {font.label ? : displayName} ); } interface FontListSkeletonProps { className: string; } function FontListSkeleton({className}: FontListSkeletonProps) { const items = Array.from(Array(20).keys()); return ( {items.map(index => (
))}
); }