-
Notifications
You must be signed in to change notification settings - Fork 377
chore(Page): convert examples to TypeScript #7735
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
Conversation
|
Preview: https://patternfly-react-pr-7735.surge.sh A11y report: https://patternfly-react-pr-7735-a11y.surge.sh |
tompsota
left a comment
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.
Hello @dominik-petrik, great job with the conversion! 🎉
I have just a couple of minor comments.
| ); | ||
| } | ||
| } | ||
| ```ts file="./VerticalNav.tsx" |
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.
Usually the file names are prefixed with the component name, in this case Page. Could you update this (and do the same with all other files as well)?
| ```ts file="./VerticalNav.tsx" | |
| ```ts file="./PageVerticalNav.tsx" |
|
|
||
| ### Vertical nav using PageHeader component | ||
|
|
||
| This example is provided becuase PageHeader and PageHeaderTools are still in use; however, going forward Masthead and Toolbar should be used to make headers rather than PageHeader and PageHeaderTools. |
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.
Could you please fix also this typo?
becuase -> because
| } from '@patternfly/react-core'; | ||
| import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon'; | ||
|
|
||
| export const VerticalPage: React.FunctionComponent = () => { |
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.
Component name should correspond with the file name. Also please check other files.
| export const VerticalPage: React.FunctionComponent = () => { | |
| export const PageMainSectionPadding: React.FunctionComponent = () => { |
| </Toolbar> | ||
| ); | ||
|
|
||
| const Header = ( |
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.
I think that the convention is to use camelCase, is that correct @nicolethoen?
| const Header = ( | |
| const header = ( |
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.
That's correct - we generally use camelCase for our variable names and PascalCase for component names. Then any text, whether prop description or example titles are all Sentence case.
| <MastheadContent>{headerToolbar}</MastheadContent> | ||
| </Masthead> | ||
| ); | ||
| const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />; |
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.
I'd add newlines around const declarations (where missing) to make the code easier to read. However I don't have strict opinion on this, what do you think @nicolethoen?
| const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />; | |
| const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />; | |
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.
I don't have a particularly strong opinion here. I think there are definitely times that using line breaks to clearly group related concepts or separate distinct concepts/steps can help with readability. I think in this case, @dominik-petrik can make a judgement call if he thinks adding the space is an improvement.
| ); | ||
| const Sidebar = <PageSidebar nav="Navigation" isNavOpen={isNavOpen} id="main-padding-sidebar" />; | ||
| return ( | ||
| <Page header={Header} sidebar={Sidebar}> |
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.
The original example actually didn't have a sidebar passed in. Maybe we should keep it that way?
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.
We discussed this via slack and we agreed on maybe it being an oversight so I added the sidebar. But no problem for me to fix it. 😊
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.
nah - sounds good for me! :)
|
I have hopefully resolved all required changes. Let me know if I missed something or if there is anything else that needs to be done. |
|
@dominik-petrik it looks good, it just needs a rebase! :) |
What: Closes #7711