From 0c8f330f5a70b285e347769187a9c6226dc5f78f Mon Sep 17 00:00:00 2001 From: DrMint Date: Sun, 13 Mar 2022 18:22:50 +0100 Subject: [PATCH] Small improvements to the RecorderChip and the Transcript lines --- src/components/Markdown/Markdawn.tsx | 81 +++++++++++++++++++--------- src/components/Markdown/TOC.tsx | 4 +- src/components/RecorderChip.tsx | 52 ++++++++++-------- src/components/ToolTip.tsx | 3 +- 4 files changed, 90 insertions(+), 50 deletions(-) diff --git a/src/components/Markdown/Markdawn.tsx b/src/components/Markdown/Markdawn.tsx index cd75fdf..51c71ba 100644 --- a/src/components/Markdown/Markdawn.tsx +++ b/src/components/Markdown/Markdawn.tsx @@ -1,5 +1,6 @@ import HorizontalLine from "components/HorizontalLine"; import InsetBox from "components/InsetBox"; +import ToolTip from "components/ToolTip"; import { useAppLayout } from "contexts/AppLayoutContext"; import Markdown from "markdown-to-jsx"; import { slugify } from "queries/helpers"; @@ -28,28 +29,60 @@ export default function Markdawn(props: ScenBreakProps): JSX.Element { children: React.ReactNode; }) => { return ( -

- {props.children} - - { - navigator.clipboard.writeText( - process.env.NEXT_PUBLIC_URL_SELF + - window.location.pathname + - "#" + - props.id - ); - }} - > - link - - -

+
+

+ {props.children} +

+ + + { + navigator.clipboard.writeText( + process.env.NEXT_PUBLIC_URL_SELF + + window.location.pathname + + "#" + + props.id + ); + }} + > + link + + + +
+ ); + }, + }, + h3: { + component: (props: { + id: string; + style: React.CSSProperties; + children: React.ReactNode; + }) => { + return ( +
+

+ {props.children} +

+ + + { + navigator.clipboard.writeText( + process.env.NEXT_PUBLIC_URL_SELF + + window.location.pathname + + "#" + + props.id + ); + }} + > + link + + + +
); }, }, @@ -82,7 +115,7 @@ export default function Markdawn(props: ScenBreakProps): JSX.Element { Transcript: { component: (props) => { return ( -
+
{props.children}
); @@ -92,7 +125,7 @@ export default function Markdawn(props: ScenBreakProps): JSX.Element { component: (props) => { return ( <> - + {props.name}

{props.children}

diff --git a/src/components/Markdown/TOC.tsx b/src/components/Markdown/TOC.tsx index b963ee1..ed2ce6b 100644 --- a/src/components/Markdown/TOC.tsx +++ b/src/components/Markdown/TOC.tsx @@ -15,8 +15,8 @@ export default function TOC(props: TOCProps): JSX.Element { return (

Table of content

-
    -
  1. +
      +
    1. router.replace(`#${toc.slug}`)}> {{toc.title}} diff --git a/src/components/RecorderChip.tsx b/src/components/RecorderChip.tsx index 2a61174..18e44c7 100644 --- a/src/components/RecorderChip.tsx +++ b/src/components/RecorderChip.tsx @@ -3,6 +3,7 @@ import { GetContentTextQuery, GetWebsiteInterfaceQuery, } from "graphql/operations-types"; +import Button from "./Button"; import Img, { ImageQuality } from "./Img"; import ToolTip from "./ToolTip"; @@ -19,41 +20,46 @@ export default function RecorderChip(props: RecorderChipProps): JSX.Element { return ( -
      +
      +
      {recorder.attributes.avatar.data && ( )} -

      {recorder.attributes.username}

      +
      +

      {recorder.attributes.username}

      + {recorder.attributes.languages.data.length > 0 && ( +
      +

      {langui.languages}:

      + {recorder.attributes.languages.data.map((language) => ( + + {language.attributes.code.toUpperCase()} + + ))} +
      + )} + {recorder.attributes.pronouns && ( +
      +

      {langui.pronouns}:

      + {recorder.attributes.pronouns} +
      + )} +
      - {recorder.attributes.languages.data.length > 0 && ( -
      -

      {langui.languages}:

      - {recorder.attributes.languages.data.map((language) => ( - - {language.attributes.code.toUpperCase()} - - ))} -
      + + {recorder.attributes.bio.length > 0 && ( +

      {recorder.attributes.bio[0].bio}

      )} - {recorder.attributes.pronouns && ( -
      -

      {langui.pronouns}:

      - {recorder.attributes.pronouns} -
      - )} -

      - {recorder.attributes.bio.length > 0 && - recorder.attributes.bio[0].bio} -

      + +
      } placement="top" + trigger="click" > {recorder.attributes.anonymize diff --git a/src/components/ToolTip.tsx b/src/components/ToolTip.tsx index aafea75..6af6cb9 100644 --- a/src/components/ToolTip.tsx +++ b/src/components/ToolTip.tsx @@ -11,8 +11,9 @@ export default function ToolTip(props: ToolTipProps): JSX.Element { if (newProps.interactive === undefined) newProps.interactive = true; if (newProps.animation === undefined) newProps.animation = "scale-subtle"; + return ( - +
      {props.children}
      );