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

[Toolbar] toolbar-title overflow #3250

Merged
merged 1 commit into from
Feb 11, 2016

Conversation

tintin1343
Copy link
Contributor

Proposed Solution

The highlighted text in the below screenshot are the needed changes. The changes are to be included in the toolbar-title.jsx file:

screen shot 2016-02-08 at 4 23 19 pm

This leads to the following change:
a) When its a long string :
screen shot 2016-02-08 at 5 26 42 pm

b) when its a small string:
screen shot 2016-02-08 at 5 28 27 pm

@newoga newoga changed the title Toolbar title [Toolbar] tolbar-title overflow Feb 9, 2016
@newoga newoga changed the title [Toolbar] tolbar-title overflow [Toolbar] toolbar-title overflow Feb 9, 2016
toolbar,
} = state.muiTheme;

return {
Copy link
Member

Choose a reason for hiding this comment

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

Could we keep this existing block?

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 this PR accidentally undoes the migration for this component 😁

@tintin1343 Could you see if you could reapply your changes to the latest version in master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was my bad. I did some extra commits when I should have not. I am making the changes in the latest version of master as we are speaking.

I will resubmit the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem, thanks @tintin1343!

@oliviertassinari oliviertassinari added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed PR: Needs Review labels Feb 9, 2016
@tintin1343
Copy link
Contributor Author

I made the suggested changes. @newoga @oliviertassinari

textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
width: (props.text.length > 40) ? 150 : 'inherit',
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to set the width here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we do for the long text to be converted to ellipses. Since the parent div has a width of 100%. I tried it without the width but it doesn't work.

The width component actually depends on the use-case though. I have put a generic width statement which is at least a bit scalable.

Please find the explanation on the issue page: #3192

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@oliviertassinari : Are there any doubts w.r.t to the width attribute?

Copy link
Member

Choose a reason for hiding this comment

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

I'm asking this because the AppBar component is not provinding any width. 40 and 150 look like magic numbers.
What if we where using flexbox here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. I agree 40 and 50 are indeed magic numbers. I tried using flex it didn't help.

Thats because the ToolbarTitle becomes a part of the ToolbarGroup and depends on the number of components being included in the ToolBar. 'AppBar' has title as a property where as ToolbarTitle is a component in itself and its width will depend on the width of its parent element.

Correct me if I am wrong here.

@newoga
Copy link
Contributor

newoga commented Feb 11, 2016

@oliviertassinari @tintin1343 I'm good with this for now. I think the <Toolbar /> component could use an overhaul or a lot of improvements in general when we merge in the composable AppBar though.

@tintin1343
Copy link
Contributor Author

@newoga : I agree. I have been working on fixing it today and realised that the component as whole needs a redesign.

@oliviertassinari : If you feel weird about the magic constants I can just rewrite it with a % value maybe which can be changed by the user based on a usecase.

@tintin1343
Copy link
Contributor Author

@oliviertassinari @newoga : I wanted to know as to why am I getting one check as failed. Not able to figure it out.

I have made the changes after my conversation with @oliviertassinari and him agreeing to keep the width attribute for now. Let me know in case you need anything else. Thanks !

@oliviertassinari
Copy link
Member

We have a flacky test. This one is failing from time to time. It looks like a uniform distribution of p=0.1. We should fix this test at some point.
Just run again the travis task.

@tintin1343
Copy link
Contributor Author

@oliviertassinari : I ran the travis task again. All checks passed this time!

@oliviertassinari oliviertassinari added PR: Review Accepted 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 Feb 11, 2016
@oliviertassinari
Copy link
Member

That's not perfect but this change shouldn't harm anybody.
I think that we will need to migrate the Toolbar to use flexbox.
capture d ecran 2016-02-12 a 00 16 18
@tintin1343 Thanks.

oliviertassinari added a commit that referenced this pull request Feb 11, 2016
[Toolbar] fix toolbar-title overflow
@oliviertassinari oliviertassinari merged commit f0f4875 into mui:master Feb 11, 2016
@tintin1343
Copy link
Contributor Author

@oliviertassinari : I agree with you completely. But that behavior still exists in the original design even when the text is small and when you minimize the screen. I can start working on redesigning the component.

Your welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Toolbar The React component.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants