Skip to content
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

Merged
merged 23 commits into from
Jan 4, 2023
Merged

O layout tsx #898

merged 23 commits into from
Jan 4, 2023

Conversation

akomiqaia
Copy link
Contributor

No description provided.

@akomiqaia akomiqaia requested a review from a team as a code owner November 24, 2022 15:48
@notlee notlee temporarily deployed to origami-webs-o-layout-t-dcxirq November 24, 2022 15:53 Inactive
@akomiqaia akomiqaia mentioned this pull request Nov 29, 2022
@notlee notlee temporarily deployed to origami-webs-o-layout-t-vpgdjb November 29, 2022 15:47 Inactive
@notlee notlee temporarily deployed to origami-webs-o-layout-t-wa52df December 1, 2022 16:46 Inactive
Copy link
Contributor

@notlee notlee left a 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.

Screenshot 2022-12-01 at 16 55 18

hero?: HeroProps;
sidebar?: SideBarProps;
footer: ChildrenType;
displayArticleList?: boolean;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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/src/tsx/layout.tsx Outdated Show resolved Hide resolved
return <QueryLayout {...args} />;
};

QueryLayoutDemo.storyName = 'Query Layout';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigation has been added in the query layout? I don't think that's intended?

Screenshot 2022-12-01 at 16 22 18

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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,
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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[];
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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;
Copy link
Contributor

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 👍

@notlee notlee temporarily deployed to origami-webs-o-layout-t-ogpjlg December 6, 2022 11:09 Inactive
@akomiqaia
Copy link
Contributor Author

From the last discussion, we spoke about improving this PR. Changes discussed were:

  • Hide controls that are not in use, remove hero controls (e081ce7)
  • Storybook demos with hero layout had the full-width grey background, that comes from this style definition. At the moment stories that use hero are rendered at the fullscreen layout (padded by default) (e081ce7)
  • rename and then remove add styles control (09c2034)

@notlee notlee self-requested a review January 4, 2023 08:42
@notlee notlee enabled auto-merge (squash) January 4, 2023 08:44
@notlee notlee merged commit 862300f into main Jan 4, 2023
@notlee notlee deleted the o-layout-tsx branch January 4, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants