/
superded
/
void
Обзор
Документация
Войти
/
superded
/
void
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
v5
quartz/components/ConditionalRender.tsx
22 строки
735 B
superded42
Initial commit
04 июл 2026, 05:05
Не верифицирован
04 июл 2026, 05:05
af1cbe5
Код
Авторство
О чём код?
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" type ConditionalRenderConfig = { component: QuartzComponent condition: (props: QuartzComponentProps) => boolean } export default ((config: ConditionalRenderConfig) => { const ConditionalRender: QuartzComponent = (props: QuartzComponentProps) => { if (config.condition(props)) { return <config.component {...props} /> } return null } ConditionalRender.afterDOMLoaded = config.component.afterDOMLoaded ConditionalRender.beforeDOMLoaded = config.component.beforeDOMLoaded ConditionalRender.css = config.component.css return ConditionalRender }) satisfies QuartzComponentConstructor<ConditionalRenderConfig>