-
Notifications
You must be signed in to change notification settings - Fork 167
Fix for react troubleshooting component heading style #5630
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
Changes from 2 commits
0a6737a
770f32b
6077819
9e15ca0
6516040
188b642
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,17 +11,20 @@ import { BlockLink } from '@18f/identity-components'; | |||||||||||||
| /** | ||||||||||||||
| * @typedef TroubleshootingOptionsProps | ||||||||||||||
| * | ||||||||||||||
| * @prop {string} heading | ||||||||||||||
| * @prop {string=} headingTag | ||||||||||||||
|
Contributor
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. For your lint error, I think TypeScript is upset about accepting an arbitrary string as a tag name. It works better for me if you explicitly make it one of the heading tags we're expecting:
Suggested change
Contributor
Author
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. Makes sense. I was thinking about the arbitrary nature of it but wasn't sure exactly how to address it in TS. |
||||||||||||||
| * @prop {string} headingText | ||||||||||||||
| * @prop {TroubleshootingOption[]} options | ||||||||||||||
| */ | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * @param {TroubleshootingOptionsProps} props | ||||||||||||||
| */ | ||||||||||||||
| function TroubleshootingOptions({ heading, options }) { | ||||||||||||||
| function TroubleshootingOptions({ headingTag = 'h2', headingText, options }) { | ||||||||||||||
|
Contributor
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. Could we call it I suppose an argument could be made that "heading level" would be the numeric value, not the tag name, so either renaming both as "heading tag", or using "heading level" as a numeric value. |
||||||||||||||
| const HeadingTag = headingTag; | ||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
|
Contributor
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 we can rename this so we don't need the separate assignment
Suggested change
Contributor
Author
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. It is not currently used but will be in the future. I can cut it out but it'll be needed when the rest of the IAL2 flow is moved into react. |
||||||||||||||
| <section className="troubleshooting-options"> | ||||||||||||||
| <h2>{heading}</h2> | ||||||||||||||
| <HeadingTag className="troubleshooting-options__heading">{headingText}</HeadingTag> | ||||||||||||||
| <ul className="troubleshooting-options__options"> | ||||||||||||||
| {options.map(({ url, text, isExternal }) => ( | ||||||||||||||
| <li key={url}> | ||||||||||||||
|
|
||||||||||||||
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.
Should we bring this option (back into) alignment b/w JSX and ERB?
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.
fixed in
6516040