/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/ui/Illustration.astro
24 строки
756 B
codecalm
Fix Prettier formatting regression and Astro type-check errors
03 авг 2026, 02:26
03 авг 2026, 02:26
f27c70a
Код
Авторство
О чём код?
--- import freeIllustrations from '@data/free-illustrations.json' interface Props { /** file name of the illustration, e.g. "boy-girl.svg" (the ".svg" suffix is stripped) */ image: string height?: number | string class?: string } const { image, height = 128, class: className } = Astro.props const key = image.replaceAll('.svg', '') const source = (freeIllustrations as { autodark: Record<string, string> }).autodark[key] ?? '' const replaceTo = `<svg class="img${className ? ` ${className}` : ''}" ` let illustration = source.replaceAll('<svg ', replaceTo) illustration = illustration.replaceAll('width="800" height="600"', `height="${height}"`) --- <!-- BEGIN ILLUSTRATION --> <Fragment set:html={illustration} /> <!-- END ILLUSTRATION -->