()
| 4 | import { parseMarkdown } from '../../utils/parseMarkdown'; |
| 5 | |
| 6 | function Intro() { |
| 7 | const [intro, setIntro] = React.useState(null); |
| 8 | const [error, setError] = React.useState(null); |
| 9 | |
| 10 | React.useEffect(() => { |
| 11 | parseMarkdown('/content/intro.md') |
| 12 | .then(({ content }) => setIntro(content)) |
| 13 | .catch(setError); |
| 14 | }, []); |
| 15 | |
| 16 | if (error) { |
| 17 | return <div style={{ color: 'red' }}> |
| 18 | Error loading intro: {error.message} |
| 19 | </div>; |
| 20 | } |
| 21 | |
| 22 | if (!intro) { |
| 23 | return <div></div>; |
| 24 | } |
| 25 | |
| 26 | return <div className="intro"> |
| 27 | <ReactMarkdown>{intro}</ReactMarkdown> |
| 28 | </div>; |
| 29 | } |
| 30 | |
| 31 | export default Intro; |
nothing calls this directly
no test coverage detected