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

[docs] Fix Tabs examples typography & standardise code #9366

Merged
merged 1 commit into from Dec 6, 2017
Merged

[docs] Fix Tabs examples typography & standardise code #9366

merged 1 commit into from Dec 6, 2017

Conversation

mbrookes
Copy link
Member

@mbrookes mbrookes commented Dec 1, 2017

Before:
image

After:
image

@mbrookes mbrookes added the docs Improvements or additions to the documentation label Dec 1, 2017
@mbrookes mbrookes changed the title [Tabs] Fix typography & standardise code [docs] Fix Tabs examples typography & standardise code Dec 1, 2017
@mbrookes mbrookes added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI v1.x and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels Dec 1, 2017
@oliviertassinari oliviertassinari added component: tabs This is the name of the generic UI component, not the React module! and removed v1.x labels Dec 4, 2017
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Oh, this was done on purpure to illustrate that we don't apply any Typography by default, the focus is on the Tabs component. But ok, your call.

<TabContainer dir={theme.direction}>Item Two</TabContainer>
<TabContainer dir={theme.direction}>Item Three</TabContainer>
</SwipeableViews>
<Typography type="body1">
Copy link
Member

Choose a reason for hiding this comment

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

I would rather put it in the TabContainer component.

Copy link
Member Author

@mbrookes mbrookes Dec 4, 2017

Choose a reason for hiding this comment

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

I considered that, but thought it would result in muliple additional components being mounted all applying the same style. I'll go with your lead on it.

Copy link
Member

Choose a reason for hiding this comment

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

Not much more effort if you replace the div with a <Typography component="div">.

{value === 4 && <TabContainer>Item Five</TabContainer>}
{value === 5 && <TabContainer>Item Six</TabContainer>}
{value === 6 && <TabContainer>Item Seven</TabContainer>}
<Typography type="body1">
Copy link
Member

Choose a reason for hiding this comment

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

I would rather put it in the TabContainer component.

@mbrookes
Copy link
Member Author

mbrookes commented Dec 4, 2017

Out of curiosity, is there a reason we can't set this at the top level as the default Typography?

@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 4, 2017

Out of curiosity, is there a reason we can't set this at the top level as the default Typography?

@mbrookes First reason I can think of is the default element used: p. It's probably not in compliance with the HTML5 spec. Also, it's unlikely real work application will get along with this pattern. I think that we should encourage people to use Typography component as close as possible to where they need it.
One last thing, I think that you can remove the type="body1" it's the default value.

@mbrookes
Copy link
Member Author

mbrookes commented Dec 4, 2017

What is more likely in a user app, setting a default font and size (with CSS / JSS global etc, or using Typography?

I don't want to add Typography to the docs example if it isn't useful for a typical user application, but I don't think we should leave it unstyled either, as it looks like a bug.

@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 4, 2017

We allow both patterns. I avoid global CSS as much as possible in the projects I'm working on. It's much more common with Bootstrap. Still, the ease of use makes consecutive changes very painful.
Nobody will let the text unstyled like we have in the demo. I think that we should listen to your instinct. You thought it was broken. Other people should have thought the same. Let's add the Typography.

<Tab value="one" label="New Arrivals in the Longest Text of Nonfiction" />
<Tab value="two" label="Item Two" />
<Tab value="three" label="Item Three" />
<Tab label="New Arrivals in the Longest Text of Nonfiction" />
Copy link
Member

Choose a reason for hiding this comment

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

Did you explicitly remove the value? Or it's a mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed it for consistency with the other examples.

Copy link
Member

Choose a reason for hiding this comment

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

OK, we will add a visual regression tests if we notice a regression in the future.

@mbrookes
Copy link
Member Author

mbrookes commented Dec 5, 2017

@oliviertassinari I hope this is what you meant regarding using component="div".

@@ -42,12 +43,14 @@ class BasicTabs extends React.Component {
<Tabs value={value} onChange={this.handleChange}>
<Tab label="Item One" />
<Tab label="Item Two" />
<Tab label="Item Three" href="#basic-tabs" />
Copy link
Member

Choose a reason for hiding this comment

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

This was added on purpuse to show the feature.

@oliviertassinari
Copy link
Member

Here is my take, let me know what you think. 519978b so we can revert in case.

@mbrookes
Copy link
Member Author

mbrookes commented Dec 5, 2017

@oliviertassinari Sure - I had tried it that way originally. Both are valid, but that mounts extra components in the DOM, so I went with the slightly broader wrapper, then revised with your component="div" suggestion. I'm fine with either way, so to happy to defer to your experience.

@oliviertassinari oliviertassinari merged commit 0e38596 into mui:v1-beta Dec 6, 2017
@mbrookes
Copy link
Member Author

mbrookes commented Dec 6, 2017

Oh, no I didn't look properly. That is better. 👍

@oliviertassinari
Copy link
Member

@mbrookes Feel free to continue the effort if you find other issues :).

@mbrookes mbrookes deleted the tabs-fix-typography branch January 20, 2018 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants