/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/ui/Tag.astro
48 строк
1 KB
Paweł Kuna
Narrow component prop types, remove unused props and dead code (#2838)
10 авг 2026, 00:14
Не верифицирован
10 авг 2026, 00:14
4f7beec
Код
Авторство
О чём код?
--- import Icon from './Icon.astro' import Flag from './Flag.astro' import Avatar from './Avatar.astro' import Badge from './Badge.astro' interface Person { full_name?: string photo?: string [key: string]: unknown } interface Props { text?: string flag?: string | undefined icon?: string person?: Person status?: string legend?: string checkbox?: boolean checked?: boolean badge?: string | number } const { text, flag, icon, person, status, legend, checkbox, checked, badge } = Astro.props --- <span class="tag"> { flag ? ( <Flag flag={flag} size="xxs" class="tag-flag" /> ) : icon ? ( <Icon name={icon} size="sm" class="tag-icon" /> ) : person ? ( <Avatar person={person} size="xxs" class="tag-avatar" /> ) : status ? ( <Badge color={status} class="tag-status badge-dot" text="" /> ) : legend ? ( <span class={`legend bg-${legend}`} /> ) : checkbox ? ( <input type="checkbox" class="form-check-input tag-check" checked={checked} /> ) : null } {text} {badge != null && <Badge class="tag-badge" text={String(badge)} />} <button type="button" class="btn-close" aria-label={text ? `Remove ${text}` : 'Remove'}></button> </span>