From 2f27e222add9bf10b55971ab915ac411e81d24f0 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Sun, 23 Jan 2022 19:25:56 +0100 Subject: Rewritten ui to use boostrap --- src/components/Content/Content.module.scss | 29 ----------------- src/components/Content/Content.tsx | 50 ++++++++---------------------- 2 files changed, 13 insertions(+), 66 deletions(-) (limited to 'src/components/Content') diff --git a/src/components/Content/Content.module.scss b/src/components/Content/Content.module.scss index 8908516..4720afd 100644 --- a/src/components/Content/Content.module.scss +++ b/src/components/Content/Content.module.scss @@ -6,33 +6,10 @@ overflow: hidden; } -.header { - flex-shrink: 0; - flex-grow: 0; - width: 100%; - display: flex; - padding: 0.5em; - background-color: black; - color: white; -} - .body { flex-grow: 1; flex-shrink: 1; overflow-y: auto; - - pre { - width: 100%; - height: 100%; - padding: 1em; - font-family: monospace; - overflow: auto; - } - - iframe { - height: 100%; - width: 100%; - } } .renderError { @@ -42,10 +19,4 @@ flex-flow: column nowrap; justify-content: center; align-items: center; - - a { - margin-top: 1em; - text-decoration: underline; - color: blue; - } } diff --git a/src/components/Content/Content.tsx b/src/components/Content/Content.tsx index cb5e6bc..0e63f30 100644 --- a/src/components/Content/Content.tsx +++ b/src/components/Content/Content.tsx @@ -1,19 +1,9 @@ -import styles from "~components/Details/Details.module.scss"; import * as React from "react"; -import classNames from "classnames"; +import {Dispatch, SetStateAction, useMemo} from "react"; import {RequestPayload, ResponsePayload} from "~hooks/useRequests"; -import { - Dispatch, - forwardRef, SetStateAction, - useEffect, - useImperativeHandle, - useMemo, - useRef, - useState -} from "react"; import ReactJson from 'react-json-view'; import styles from './Content.module.scss'; -import {Col, Container, Row} from "react-bootstrap"; +import {Button, Col, Container, Row} from "react-bootstrap"; function getHeader(headers: { [key: string]: string }, key: string, unit?: string): string | null { console.log(headers, key) @@ -37,7 +27,7 @@ interface ContentProps { export default function Content({ raw, setRaw, data }: ContentProps): JSX.Element { return ( - <> +
@@ -54,7 +44,7 @@ export default function Content({ raw, setRaw, data }: ContentProps): JSX.Elemen - + {(() => { try { return ContentBody({ data, raw }) @@ -62,33 +52,13 @@ export default function Content({ raw, setRaw, data }: ContentProps): JSX.Elemen return (

Body could not be rendered

- setRaw(true)}>View raw +
) } })()}
- - //
- //
- // setRaw(!raw)}/> - // - //
- //
- // {(() => { - // try { - // return ContentBody({ ...props, raw }) - // } catch { - // return ( - //
- //

Body could not be rendered

- // setRaw(true)}>View raw - //
- // ) - // } - // })()} - //
- //
+
) }; @@ -103,7 +73,13 @@ function ContentBody({ data, raw = false }: Omit) { }, [data, raw]); if (raw) { - return
{atob(data.body)}
+ return ( +
+          
+            {atob(data.body)}
+          
+        
+ ) } if (['application/pdf', 'text/html'].includes(contentType)) { -- cgit v1.2.3