microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
packages/html-program-viewer/src/common.tsx
49lines · modecode
| 1 | import React, { FunctionComponent, PropsWithChildren } from "react"; |
| 2 | |
| 3 | export const Group: FunctionComponent<PropsWithChildren<{}>> = ({ children }) => { |
| 4 | return <div className="group">{children}</div>; |
| 5 | }; |
| 6 | |
| 7 | export interface SectionProps { |
| 8 | title: string; |
| 9 | id?: string; |
| 10 | hide?: boolean; |
| 11 | } |
| 12 | |
| 13 | export const Section: FunctionComponent<PropsWithChildren<SectionProps>> = ({ |
| 14 | id, |
| 15 | title, |
| 16 | hide, |
| 17 | children, |
| 18 | }) => { |
| 19 | if (hide) { |
| 20 | return <div></div>; |
| 21 | } |
| 22 | return ( |
| 23 | <div className="section" id={id}> |
| 24 | <div className="section-title">{title}</div> |
| 25 | <div className="section-content">{children}</div> |
| 26 | </div> |
| 27 | ); |
| 28 | }; |
| 29 | |
| 30 | export const Item: FunctionComponent<PropsWithChildren<SectionProps>> = ({ |
| 31 | id, |
| 32 | title, |
| 33 | hide, |
| 34 | children, |
| 35 | }) => { |
| 36 | if (hide) { |
| 37 | return <div></div>; |
| 38 | } |
| 39 | return ( |
| 40 | <div className="item" id={id}> |
| 41 | <div className="item-title">{title}</div> |
| 42 | <div className="item-content">{children}</div> |
| 43 | </div> |
| 44 | ); |
| 45 | }; |
| 46 | |
| 47 | export const Literal: FunctionComponent<PropsWithChildren<{}>> = ({ children }) => { |
| 48 | return <div className="literal">{children}</div>; |
| 49 | }; |