-
-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for markdown in toggle descriptions #6453
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -12,6 +12,10 @@ import { | |||||
StyledDescription, | ||||||
} from './LinkCell.styles'; | ||||||
|
||||||
//@ts-ignore | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious - Why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because |
||||||
import removeMd from 'remove-markdown'; | ||||||
import { SimpleMarkdown } from 'component/common/Markdown/Markdown'; | ||||||
|
||||||
interface ILinkCellProps { | ||||||
title?: string; | ||||||
to?: string; | ||||||
|
@@ -26,23 +30,25 @@ export const LinkCell: React.FC<ILinkCellProps> = ({ | |||||
subtitle, | ||||||
children, | ||||||
}) => { | ||||||
const subTitleClean = removeMd(subtitle); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this casing is more consistent, since it matches the original name. Alternatively, if it's more readable, we could use something like
Suggested change
|
||||||
|
||||||
const { searchQuery } = useSearchHighlightContext(); | ||||||
|
||||||
const renderSubtitle = ( | ||||||
<ConditionallyRender | ||||||
condition={Boolean(subtitle && subtitle.length > 40)} | ||||||
condition={Boolean(subTitleClean && subTitleClean.length > 40)} | ||||||
show={ | ||||||
<HtmlTooltip title={subtitle} placement='bottom-start' arrow> | ||||||
<HtmlTooltip title={<SimpleMarkdown>{subtitle || ''}</SimpleMarkdown>} placement='bottom-start' arrow> | ||||||
<StyledDescription data-loading> | ||||||
<Highlighter search={searchQuery}> | ||||||
{subtitle} | ||||||
{subTitleClean} | ||||||
</Highlighter> | ||||||
</StyledDescription> | ||||||
</HtmlTooltip> | ||||||
} | ||||||
elseShow={ | ||||||
<StyledDescription data-loading> | ||||||
<Highlighter search={searchQuery}>{subtitle}</Highlighter> | ||||||
<Highlighter search={searchQuery}>{subTitleClean}</Highlighter> | ||||||
</StyledDescription> | ||||||
} | ||||||
/> | ||||||
|
@@ -53,15 +59,15 @@ export const LinkCell: React.FC<ILinkCellProps> = ({ | |||||
<StyledTitle | ||||||
data-loading | ||||||
style={{ | ||||||
WebkitLineClamp: subtitle ? 1 : 2, | ||||||
lineClamp: subtitle ? 1 : 2, | ||||||
WebkitLineClamp: subTitleClean ? 1 : 2, | ||||||
lineClamp: subTitleClean ? 1 : 2, | ||||||
}} | ||||||
> | ||||||
<Highlighter search={searchQuery}>{title}</Highlighter> | ||||||
{children} | ||||||
</StyledTitle> | ||||||
<ConditionallyRender | ||||||
condition={Boolean(subtitle)} | ||||||
condition={Boolean(subTitleClean)} | ||||||
show={renderSubtitle} | ||||||
/> | ||||||
</StyledContainer> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the way vite bundles dependencies, and for consistency sake, I think this belongs in
devDependencies
instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this was a lazy mistake by me.