-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): lazy load markdown title + desc, fix CSS issues etc
- `react-markdown` and `remark-gfm` are large deps, so we should lazy load them - and we should only load them if a user is using this feature - can't quite detect if a string is markdown without a dep, but can at least check if the annotations are used - CSS had several issues - was imported from the wrong component - `overlay` was not sufficiently unique (as we currently use global CSS and not something like CSS Modules) - some unnecessary CSS attributes - most importantly, the positioning of rows broke and did not flex to the last column - it caused columns to not match the heading very confusingly and a lot of empty space on the right as well - that also broke some overflow properties - and it broke the details drawer as well - remove `Link` for the entire row as it was unintuitive, especially with the drawer - one could also not copy+paste things from the row because it caused a click - only link the workflow name now - fix nested link issues - capture the event, prevent bubble up, and process it with JS Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
- Loading branch information
Showing
4 changed files
with
61 additions
and
48 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
ui/src/app/workflows/components/workflows-row/react-markdown-gfm.tsx
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,26 @@ | ||
import React from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
|
||
import {openLinkWithKey} from '../../../shared/components/links'; | ||
|
||
export function ReactMarkdownGfm({markdown}: {markdown: string}) { | ||
return ( | ||
<ReactMarkdown components={{p: React.Fragment, a: NestedAnchor}} remarkPlugins={[remarkGfm]}> | ||
{markdown} | ||
</ReactMarkdown> | ||
); | ||
} | ||
export default ReactMarkdownGfm; // for lazy loading | ||
|
||
function NestedAnchor(props: React.ComponentProps<'a'>) { | ||
return ( | ||
<a | ||
{...props} | ||
onClick={ev => { | ||
ev.preventDefault(); // don't bubble up | ||
openLinkWithKey(props.href); // eslint-disable-line react/prop-types -- it's not interpreting the prop types correctly | ||
}} | ||
/> | ||
); | ||
} |
20 changes: 0 additions & 20 deletions
20
ui/src/app/workflows/components/workflows-row/workflows-row-name.tsx
This file was deleted.
Oops, something went wrong.
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