/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/ui/SwitchIcon.astro
26 строк
788 B
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' interface Props { icon?: string iconBColor?: string variant?: string } const { icon = 'heart', iconBColor = 'red', variant } = Astro.props const resolvedIconB = icon ?? 'heart' // star/heart force the filled variant; otherwise no extra class. const resolvedIconBClass = icon === 'star' || icon === 'heart' ? 'icon-filled' : undefined const buttonClass = ['switch-icon', variant && `switch-icon-${variant}`] --- <button type="button" class:list={buttonClass} data-bs-toggle="switch-icon" aria-pressed="false" aria-label="Favorite"> <span class="switch-icon-a text-muted"> <Icon name={icon} /> </span> <span class={`switch-icon-b text-${iconBColor}`}> <Icon name={resolvedIconB} class={resolvedIconBClass} /> </span> </button>