/
githubmirror
/
Prompt-Engineering-Guide
Обзор
Документация
Войти
/
githubmirror
/
Prompt-Engineering-Guide
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
components/ContentFileNames.tsx
31 строка
854 B
Elvis Saravia
Fix TypeScript error in ContentFileNames component
14 окт 2025, 00:17
14 окт 2025, 00:17
71aea1b
Код
Авторство
О чём код?
// components/ContentFileNames.tsx import React, { useEffect, useState } from 'react'; import { Cards, Card } from 'nextra-theme-docs'; import { FilesIcon } from './icons'; const ContentFileNames = ({ section = 'research', lang = 'en' }) => { const [fileNames, setFileNames] = useState([]); useEffect(() => { fetch(`/api/contentFiles?section=${section}&lang=${lang}`) .then(response => response.json()) .then(data => setFileNames(data.fileNames)); }, [section, lang]); return ( <Cards> {fileNames.map(({ slug, title }, index) => ( <React.Fragment key={index}> <Card icon={<FilesIcon />} title={title} href={`/${section}/${slug}`} children={<></>} /> </React.Fragment> ))} </Cards> ); }; export default ContentFileNames;