Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Update PageHeader to render subtitle as an h2#106

Merged
koddsson merged 2 commits intolegacyfrom
hturan/cf-component-page-subtitle
Jun 2, 2017
Merged

Update PageHeader to render subtitle as an h2#106
koddsson merged 2 commits intolegacyfrom
hturan/cf-component-page-subtitle

Conversation

@hturan
Copy link
Contributor

@hturan hturan commented Mar 20, 2017

This is a super-simple SEMVER-major PR to make cf-component-page's PageHeader render it's subtitle prop as an h2.

I've run npm run update-snapshot and committed the changes for cf-component-page. Is this correct? I couldn't find any documentation about how to do this so just picked the most relevant script 😄

@sejoker
Copy link
Contributor

sejoker commented Mar 20, 2017

LGTM

@sejoker sejoker self-requested a review March 20, 2017 14:05
@sejoker
Copy link
Contributor

sejoker commented Mar 20, 2017

@hturan could lay out your reasoning behind the change.

@hturan
Copy link
Contributor Author

hturan commented Mar 20, 2017

It looks like CI is failing on a completely separate suite; cf-component-notifications. Anyone know what's going on there?

@manatarms Ah ace, sorry for not checking! Feel free to make the change and close this PR when that lands 👍 This isn't super urgent, but let me know roughly how long you think your PR will take to land.

@sejoker There are a variety of reasons, but mainly: if title is an h1, subtitle should semantically be an h2 and also our current Backbone page implementation has the tag as an h2.

<h1 className="cf-page__title">{this.props.title}</h1>
{this.props.subtitle &&
<p className="cf-page__subtitle">{this.props.subtitle}</p>}
<h2 className="cf-page__subtitle">{this.props.subtitle}</h2>}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not cf-component-heading?

Copy link
Contributor

@manatarms manatarms Mar 20, 2017

Choose a reason for hiding this comment

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

@jwineman I like the idea of using cf-component-heading, but it would introduce a dependency in cf-component-page. So it depends on if we want that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should avoid it whenever possible. However we have instances where our components depend on each other. cf-component-card has a dependency on cf-component link for example.

If we expect this <h2> to look and function the same as cf-component-heading we should introduce that dependency here since not doing so makes this use a customization that will limit its ability to get future updates we make to that component. This has technically already happened since cf-component-heading has been converted to Fela but this component is still using hard coded CSS classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually the right approach. There's only one kind of PageHeader, and the default styles in cf-component-heading are not contextual. <Heading size={2}> can mean very different things in different circumstances. There's no one size fits all approach here, as evident by the <h1> above.

@tajo
Copy link
Contributor

tajo commented Mar 20, 2017

@hturan

It looks like CI is failing on a completely separate suite; cf-component-notifications. Anyone know what's going on there?

Yea, it's a flaky test that sometimes time outs. :-/

@tajo
Copy link
Contributor

tajo commented Mar 20, 2017

@hturan I reran travis. Works this time.

@tajo tajo self-requested a review March 20, 2017 21:33
@manatarms
Copy link
Contributor

Don't merge this because I'm working on making PageHeader use Heading.

Copy link
Contributor

@wyuenho wyuenho left a comment

Choose a reason for hiding this comment

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

@hturan Can you retarget this PR to legacy? Otherwise LGTM.

<h1 className="cf-page__title">{this.props.title}</h1>
{this.props.subtitle &&
<p className="cf-page__subtitle">{this.props.subtitle}</p>}
<h2 className="cf-page__subtitle">{this.props.subtitle}</h2>}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually the right approach. There's only one kind of PageHeader, and the default styles in cf-component-heading are not contextual. <Heading size={2}> can mean very different things in different circumstances. There's no one size fits all approach here, as evident by the <h1> above.

@wyuenho wyuenho changed the base branch from master to legacy April 3, 2017 22:54
@koddsson
Copy link
Contributor

koddsson commented Jun 1, 2017

Any updates on this? @manatarms it seems that #102 has been closed so I assume it's not blocking any more?

@manatarms
Copy link
Contributor

I think this is ok to merge.

@koddsson
Copy link
Contributor

koddsson commented Jun 2, 2017

@hturan Can we merge this or has this passed its last-sell-by date? 💩

@hturan
Copy link
Contributor Author

hturan commented Jun 2, 2017

@koddsson I don't even know any more. Let's ship it!

@koddsson
Copy link
Contributor

koddsson commented Jun 2, 2017

:shipit: :shipit: :shipit:

@koddsson koddsson merged commit a015887 into legacy Jun 2, 2017
@koddsson koddsson deleted the hturan/cf-component-page-subtitle branch June 2, 2017 13:07
@koddsson
Copy link
Contributor

koddsson commented Jun 2, 2017

Fuuuuuu, this is the wrong branch innit?

@koddsson koddsson restored the hturan/cf-component-page-subtitle branch June 2, 2017 13:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants