microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e07d86c87a444d4145b98d85fa416eca819e251c

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

packages/html-program-viewer/src/common.tsx

71lines · modecode

1import React, { FunctionComponent, PropsWithChildren } from "react";
2import _styled from "styled-components";
3export const styled = typeof _styled === "function" ? _styled : (_styled as any).default;
4
5export interface SectionProps {
6 title: string;
7 id?: string;
8 hide?: boolean;
9}
10
11const SectionDiv = styled.div`
12 border: 1px solid #c5c5c5;
13`;
14const SectionTitle = styled.div`
15 border-bottom: 1px solid #c5c5c5;
16 background-color: #4875ca;
17 color: #f5f5f5;
18 padding: 2px 5px;
19`;
20const SectionContent = styled.div`
21 padding: 1rem;
22`;
23export const Section: FunctionComponent<PropsWithChildren<SectionProps>> = ({
24 id,
25 title,
26 hide,
27 children,
28}) => {
29 if (hide) {
30 return <div></div>;
31 }
32 return (
33 <SectionDiv id={id}>
34 <SectionTitle>{title}</SectionTitle>
35 <SectionContent>{children}</SectionContent>
36 </SectionDiv>
37 );
38};
39
40const ItemDiv = styled.div`
41 border: 1px solid #c5c5c5;
42`;
43const ItemTitle = styled.div`
44 border-bottom: 1px solid #c5c5c5;
45 background-color: #dedede;
46 padding: 2px 5px;
47`;
48const ItemContent = styled.div`
49 padding: 1rem;
50`;
51export const Item: FunctionComponent<PropsWithChildren<SectionProps>> = ({
52 id,
53 title,
54 hide,
55 children,
56}) => {
57 if (hide) {
58 return <div></div>;
59 }
60 return (
61 <ItemDiv id={id}>
62 <ItemTitle>{title}</ItemTitle>
63 <ItemContent>{children}</ItemContent>
64 </ItemDiv>
65 );
66};
67
68export const Literal = styled.div`
69 color: #5da713;
70 display: inline;
71`;
72