/
githubmirror
/
Open-Assistant
Обзор
Документация
Войти
/
githubmirror
/
Open-Assistant
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
website/src/components/JsonCard.tsx
19 строк
600 B
notmd
Avoid chat flash render (#2483)
12 апр 2023, 21:20
Не верифицирован
12 апр 2023, 21:20
734ff2c
Код
Авторство
О чём код?
import { Card, CardBody } from "@chakra-ui/card"; import { CardBodyProps, CardProps } from "@chakra-ui/react"; import { StrictOmit } from "ts-essentials"; type JsonCardProps = StrictOmit<CardProps, "children"> & { // eslint-disable-next-line @typescript-eslint/no-explicit-any children: any; bodyProps?: CardBodyProps; }; export const JsonCard = ({ children, bodyProps, ...props }: JsonCardProps) => { return ( <Card variant="json" {...props}> <CardBody overflowX="auto" {...bodyProps}> <pre>{JSON.stringify(children, null, 2)}</pre> </CardBody> </Card> ); };