-
Notifications
You must be signed in to change notification settings - Fork 3
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(AlertLayout): render markdown content #93
base: main
Are you sure you want to change the base?
Conversation
424b8c9
to
1728aed
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #93 +/- ##
==========================================
+ Coverage 74.85% 75.04% +0.19%
==========================================
Files 38 38
Lines 505 509 +4
Branches 96 97 +1
==========================================
+ Hits 378 382 +4
Misses 90 90
Partials 37 37 ☔ View full report in Codecov by Sentry. |
1728aed
to
b056797
Compare
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.
Would you be able to add a basic storybook story here so people know this is possible?
Also you will want to change your PR title to adhere to conventional commit syntax so it auto-releases a new version of the library.
b056797
to
db950ae
Compare
db950ae
to
4293c34
Compare
* use react-markdown in alerts to render markdown content as html * try changing module resolution and module settings to fix compat issue in react-markdown --------- Co-authored-by: Aaron Ross <[email protected]> Co-authored-by: Aaron Ross <[email protected]>
a98807c
to
699d0ba
Compare
699d0ba
to
22df851
Compare
|
||
export function AlertLayout({ text, uischema }: LabelProps & RendererProps) { | ||
const options = uischema.options as AlertLayoutOptions | ||
const options = (uischema?.options ?? { style: {} }) as AlertLayoutOptions |
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.
it'd make this more runtime safe if you were to cast uischema instead:
const options = (uischema as LabelLayoutUISchema<unknown>).options
ie if AlertLayoutOptions gets a required property, the current cast would still steamroll it, allowing the code to later do something like
options.newRequiredProperty.OopsThisWillBeATypeError
@@ -98,3 +98,46 @@ export const Success: Story = { | |||
} satisfies UISchema<typeof schema>, | |||
}, | |||
} | |||
|
|||
export const Mardown: Story = { |
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.
typo
style={{ marginBottom: "24px" }} | ||
type={options?.type} | ||
message={text} | ||
showIcon |
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.
This is a breaking change--you could add it to AlertLayoutOptions
's pick of AlertProps
if you want it to be configurable
return ( | ||
<Alert | ||
style={{ marginBottom: "24px" }} | ||
type={options?.type} | ||
message={text} |
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.
what is the effect of using message vs description here? would this be a breaking change?
Why
Alerts are unable to render markdown style content like links, simple
code blocks
or other elements that may be in use in our doc strings or would be helfpful for users (links to documentation).p
tags withspan
for converted regular text