/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/components/cards/UserCardBg.astro
38 строк
1 KB
Paweł Kuna
Enable `astro/tsconfigs/strictest` in the shared package (#2836)
08 авг 2026, 02:27
Не верифицирован
08 авг 2026, 02:27
e520b32
Код
Авторство
О чём код?
--- // person = people[person-id]; the cover photo is photos[person-id].file. import Avatar from '@ui/Avatar.astro' import people from '@data/people.json' import photos from '@data/photos.json' import { requireIndex } from '@shared/lib/array' interface Person { full_name?: string job_title?: string photo?: string [key: string]: unknown } interface Photo { file?: string [key: string]: unknown } interface Props { personId?: number blurred?: boolean } const { personId = 0, blurred } = Astro.props const person = requireIndex(people as Person[], personId) const photo = requireIndex(photos as Photo[], personId) --- <a class="card card-link" href="#"> <div class={`card-cover text-center${blurred ? ' card-cover-blurred' : ''}`} style={`background-image: url(./static/photos/${photo.file})`}> <Avatar size="xl" person={person} thumb /> </div> <div class="card-body text-center"> <h3 class="card-title mb-1">{person.full_name}</h3> <div class="text-secondary">{person.job_title}</div> </div> </a>