mirror of
https://github.com/tabler/tabler.git
synced 2026-08-29 13:21:29 +04:00
22 lines
656 B
Plaintext
22 lines
656 B
Plaintext
---
|
|
import Icon from './Icon.astro'
|
|
|
|
interface Props {
|
|
value?: number
|
|
unit?: string | undefined
|
|
class?: string
|
|
}
|
|
|
|
const { value = 25, unit = '%', class: className } = Astro.props
|
|
|
|
const trendingColor = value > 0 ? 'green' : value === 0 ? 'muted' : 'red'
|
|
const trendingIcon = value > 0 ? 'arrow-up' : value === 0 ? 'minus' : 'arrow-down'
|
|
|
|
const classes = [`text-${trendingColor} d-inline-flex align-items-center lh-1`, className]
|
|
---
|
|
|
|
<span class:list={classes}>
|
|
<span class="visually-hidden">{value > 0 ? 'Increased by' : value < 0 ? 'Decreased by' : 'No change,'} </span>{value}{unit}
|
|
<Icon name={trendingIcon} class="ms-0" size="sm" />
|
|
</span>
|