/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/ui/ScaleLegend.astro
22 строки
673 B
Paweł Kuna
Narrow component prop types, remove unused props and dead code (#2838)
10 авг 2026, 00:14
Не верифицирован
10 авг 2026, 00:14
4f7beec
Код
Авторство
О чём код?
--- // "Less -> More" gradient legend, e.g. for a choropleth map's color scale. interface Props { class?: string } const { class: className } = Astro.props const steps = 10 const color = 'primary' const minLabel = 'Less' const maxLabel = 'More' const items = Array.from({ length: steps }, (_, i) => i + 1) --- <div class:list={['d-flex align-items-center gap-2', className]}> <div class="text-secondary">{minLabel}</div> <div class="d-flex gap-1"> {items.map((step) => <span class="legend" style={`background: color-mix(in srgb, transparent, var(--tblr-${color}) ${(step / steps) * 100}%);`} />)} </div> <div class="text-secondary">{maxLabel}</div> </div>