-
Notifications
You must be signed in to change notification settings - Fork 14
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
O layout tsx #898
O layout tsx #898
Conversation
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 came together more quickly than I expected, nice work 😄 I think there are areas we can improve though from a user experience perspective, as noted above in the review comments.
We should also review the controls to make sure they are all helpful. A lot of props are for children, which display this kind of nonsense in the controls! Perhaps some controls should be hidden. Maybe new controls should be configured within a story, as a more helpful demo for generating html to copy, and mapped to the relevant props.
hero?: HeroProps; | ||
sidebar?: SideBarProps; | ||
footer: ChildrenType; | ||
displayArticleList?: boolean; |
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 prop toggles a o-layout-typography
class right? Could you explain why it's called displayArticleList
?
Aside, perhaps we should also off some o-layout typography wrapper tsx component o-layout-typography?
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.
@notlee it refers to article list part of the documentation.
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 o-layout-typography
class can be used within any layout though, should the prop be more generic? FYI it can also can used multiple times throughout the page https://registry.origami.ft.com/components/o-layout@5.2.4/readme?brand=core#typography
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.
So yea this toggles o-layout-typography
for landing layout. I changed the name of it but according to docs if we are using article list inside the main content we need to remove o-layout-typography
class.
components/o-layout/stories/internal/internalLayout.stories.tsx
Outdated
Show resolved
Hide resolved
return <QueryLayout {...args} />; | ||
}; | ||
|
||
QueryLayoutDemo.storyName = 'Query Layout'; |
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.
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.
@notlee documentation suggests that it supports sidebar navigation. Happy to update documentation and templates if this is no longer supported.
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.
Oh cool, good spot, that's fine :) Though it's disabled by default so it would be better to be off by default in the demos too
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.
a87d9e1 made a few changes here so we could destroy sidebar nav correctly and also not to allow duplicate nodes in case of rerendering
|
||
export function OverviewSections({ | ||
sections, | ||
hasAction, |
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 don't need a user to specify a hasAction
prop, we can derive it based on whether any sections
have an actionElement
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.
@@ -0,0 +1,54 @@ | |||
import {HeroProps, OverviewSectionsProps, ArticleListProps} from './layout'; | |||
|
|||
export function Hero({muted, heroContent}: HeroProps) { |
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.
Have you considered passing heroContent
as children
?
<Hero>
<p>hello world!</p>
</Hero>
vs.
const heroContent = <p>hello world!</p>;
<Hero heroContent={heroContent}/>
|
||
type SideBarProps = { | ||
customNavHeadingSelector?: string; | ||
customNavigation?: JSX.Element | JSX.Element[]; |
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.
Similar to before, could customNavigation
work well as children
?
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.
617c3a4 what do you think about this update?
A short summary of the commit:
removed SideBarProps
and instead moved customNavHeadingSelector
prop to controls. For custom navigation, if users pass down any children to DocsLayout
it will render custom navigation. I added some comments and an example inside a story file.
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.
or I guess we could use a decorator for this too and have a boolean control to display custom sidebar navigation?
}; | ||
|
||
type OverviewSectionItemProps = { | ||
element: ChildrenType; |
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 think element
is very descriptive here, perhaps content
? Although again maybe children
would be a better interface to provide section content?
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.
00cac54 updated it to content. We could use children too but OverviewSections
expects an array of objects.
|
||
type OverviewSectionItemProps = { | ||
element: ChildrenType; | ||
actionElement?: ChildrenType; |
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.
actionElement
on the other hand sounds reasonably descriptive 👍
…text for our HTML plugin
…ies that had hero background on full width
From the last discussion, we spoke about improving this PR. Changes discussed were:
|
No description provided.