-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: emui package details page (#1873)
## Description: This PR implements the emui package details page. The change @adschwartz to refactor keyboard listener code requested in #1865 is also included. It also fixes the poor rendering of the catalog logos on chrome. Additionally it implements feedback Tise left on the designs for me to pick up, specifically: * Value card icon appearance * Use preferred round star icon * Update the run button appearance and interaction behaviour to match the designs. Finally, quite a large addition is included to support the combination of `react-markdown` and `chakra` in the `KurtosisMarkdown` component which includes basic chakra implementations of the html components. This is required because `CSSReset` (part of chakra theme) unsets all of the styling that would apply to markdown. ### Short demo https://github.com/kurtosis-tech/kurtosis/assets/4419574/19826393-10b2-40de-832b-6970f305a2ce ## Is this change user facing? YES ## References (if applicable): * Figma
- Loading branch information
Showing
26 changed files
with
533 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Code, Divider, Heading, Image, Link, Table, Tbody, Td, Text, Th, Thead, Tr } from "@chakra-ui/react"; | ||
import { DetailedHTMLProps, HTMLAttributes } from "react"; | ||
import Markdown, { Components } from "react-markdown"; | ||
|
||
const heading = | ||
(level: 1 | 2 | 3 | 4 | 5 | 6) => | ||
({ children }: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) => { | ||
const sizes = ["xl", "lg", "md", "sm", "xs", "xs"]; | ||
return ( | ||
<Heading my={4} as={`h${level}`} size={sizes[`${level - 1}`]}> | ||
{children} | ||
</Heading> | ||
); | ||
}; | ||
|
||
const componentStrategy: Components = { | ||
h1: heading(1), | ||
h2: heading(2), | ||
h3: heading(3), | ||
h4: heading(4), | ||
h5: heading(5), | ||
h6: heading(6), | ||
p: (props) => { | ||
const { children } = props; | ||
return <Text mb={2}>{children}</Text>; | ||
}, | ||
em: (props) => { | ||
const { children } = props; | ||
return <Text as="em">{children}</Text>; | ||
}, | ||
blockquote: (props) => { | ||
const { children } = props; | ||
return ( | ||
<Code as="blockquote" p={2}> | ||
{children} | ||
</Code> | ||
); | ||
}, | ||
code: ({ children }) => { | ||
return <Code children={children} />; | ||
}, | ||
del: (props) => { | ||
const { children } = props; | ||
return <Text as="del">{children}</Text>; | ||
}, | ||
hr: (props) => { | ||
return <Divider />; | ||
}, | ||
a: Link, | ||
img: (props) => <Image src={props.src} />, | ||
text: (props) => { | ||
const { children } = props; | ||
return <Text as="span">{children}</Text>; | ||
}, | ||
pre: (props) => { | ||
const { children } = props; | ||
return ( | ||
<Text margin={1} as={"pre"}> | ||
{children} | ||
</Text> | ||
); | ||
}, | ||
table: Table, | ||
thead: Thead, | ||
tbody: Tbody, | ||
tr: (props) => <Tr>{props.children}</Tr>, | ||
td: (props) => <Td>{props.children}</Td>, | ||
th: (props) => <Th>{props.children}</Th>, | ||
}; | ||
|
||
type KurtosisMarkdownProps = { | ||
children?: string; | ||
}; | ||
|
||
export const KurtosisMarkdown = ({ children }: KurtosisMarkdownProps) => { | ||
return ( | ||
<Markdown components={componentStrategy} skipHtml> | ||
{children} | ||
</Markdown> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.