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] Add demo for a bottom app bar #13030

Merged
merged 18 commits into from
Oct 12, 2018

Conversation

adeelibr
Copy link
Contributor

@adeelibr adeelibr commented Sep 28, 2018

Added a demo in the app-bar section for bottom app-bar.

Related to issue:
#12956 (comment)

appbar

Edit from @eps1lon:
preview of the created demo from this PR

@oliviertassinari oliviertassinari added the PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI label Sep 29, 2018
@mbrookes mbrookes changed the title [Appbar] Added Demo For A Bottom Appbar [Appbar] Add demo for a bottom App Bar Sep 29, 2018
@mbrookes mbrookes changed the title [Appbar] Add demo for a bottom App Bar [docs] Add demo for a bottom app bar Sep 29, 2018
@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 2, 2018

@oliviertassinari can you please tell me, the improvement/changes that I need to do for this? :)

@oliviertassinari
Copy link
Member

@adeelibr It comes from my understanding that the pull request isn't finished yet.

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 2, 2018

Can you kindly provide me with some feedback, on the missing stuff from this PR. So that I can start working on it right away. I thought I was done 😅

@oliviertassinari
Copy link
Member

Form my understanding the main pain point to solve is around scroll handling, both for top and bottom app bar. We could also have a demo with icons, closer to what the specification demonstrate.

@mbrookes
Copy link
Member

mbrookes commented Oct 2, 2018

You could try following this example: https://material.io/design/components/app-bars-bottom.html#anatomy

Centered FAB seems to be the defacto (I'm aware we need fix the default color...).

@@ -38,3 +38,7 @@ A primary searchbar.
## Dense (desktop only)

{{"demo": "pages/demos/app-bar/DenseAppBar.js"}}

## Appbar Fixed Bottom
Copy link
Member

Choose a reason for hiding this comment

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

"Bottom App Bar"?

return (
<div className={classes.container}>
<section className={classes.main}>
<p>
Copy link
Member

Choose a reason for hiding this comment

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

Typography (Although I'm not mad on the wall of text for this demo.)

Copy link
Member

Choose a reason for hiding this comment

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

Actually, according to the spec, it isn't even valid usage: https://material.io/design/components/app-bars-bottom.html#usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood! Working on it! I am sorry for the late reply, I have been stuck with office work! I'll have it done by tomorrow. Thank you for your guidance.

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 4, 2018

Is this better @mbrookes @oliviertassinari ? I tried replicating the example from material design

aa6usvoccsie

@mbrookes
Copy link
Member

mbrookes commented Oct 4, 2018

@adeelibr Better, but based on the text and choice of icons, that looks like a top app bar moved to the bottom. Better to follow the example from the spec as requested.

Also, as mentioned, thebottom app bar isn't valid usage in conjunction with a page of text:

Actually, according to the spec, it isn't even valid usage: https://material.io/design/components/app-bars-bottom.html#usage"

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 7, 2018

@mbrookes did you mean something like this?

ruvettgwwd

and on mobile;

aaaa

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 7, 2018

Also while I was looking at the link you shared above, one link let to the other 😄 and I found an issue created on the material-components material-components/material-components-web#2659 Some one made an example with the AppBar with fab icon in center cut http://jsfiddle.net/Toufic/czpb8u0f/5/

Would it be okay to add this example using our components in the Appbar documentation, I'd love to create another PR after this is done, .. whenever this is done. 😅

@mbrookes
Copy link
Member

mbrookes commented Oct 7, 2018

Much better. You could lose the "Material-UI" text (that doesn't belong on a bottom AppBar), and set a width on the demo. You could follow: https://material-ui.com/demos/buttons/#floating-action-buttons (width: 500).

The FAB doesn't appear to stay centered as you resize.

The "Inbox" label at the top of the list doesn't look right to me. Do you have a an example of that from the spec? You could make the subheader sticky though.

Regarding the MCW inset example, it's a clever hack, but it doesn't meet the spec in a couple of important ways. The cutout is solid white rather than transparent, so content scrolled behind would get cut off. The corners of the cutout aren't rounded. IT doesn't support scrolling the app-bar out of view.

Interesting to see that MCW uses CSS variables. (No IE11 or Opera Mini support.)

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 7, 2018

The "Inbox" label at the top of the list doesn't look right to me. Do you have a an example of that from the spec? You could make the subheader sticky though.

I took the example from https://material.io/design/components/app-bars-bottom.html#behavior

I have made the subheader sticky.

lgic95qv9i

Regarding the MCW inset example, it's a clever hack, but it doesn't meet the spec in a couple of important ways. The cutout is solid white rather than transparent, so content scrolled behind would get cut off. The corners of the cutout aren't rounded. IT doesn't support scrolling the app-bar out of view.

Interesting to see that MCW uses CSS variables. (No IE11 or Opera Mini support.)

The examples where not official, it was made by a contributor. But MCW hasn't added it into their official docs.

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 7, 2018

Also regarding the implementation I showed earlier, I played with it a bit, and I can see the content behind the fab button. As you can below. Your thoughts?

lgic95qv9i

regarding the part

IT doesn't support scrolling the app-bar out of view.

I think we can play with this using vanilla js specifically the scroll event listener. window.addEventListener("scroll", () => {});

@mbrookes
Copy link
Member

mbrookes commented Oct 7, 2018

I can see the content behind the fab button

Interesting. There appeared to be a solid white bar behind the purple bar. I admit I didn't try creating scrollable content.

@mbrookes
Copy link
Member

mbrookes commented Oct 7, 2018

There appeared to be a solid white bar behind the purple bar.

Okay, no, it's actually a transparent bar with a drop-shadow, it just looked white due to the white background:

image

This does mean that there's a shadow where there shouldn't be, overlaying the content behind, but nothing you can do about that with pure CSS.

It doesn't support scrolling the app-bar out of view.

I think we can play with this using vanilla js specifically the scroll event listener. window.addEventListener("scroll", () => {});

No, that isn't the problem: since the "cut-out" is a transparent div with a border-radius, there's no way to change the shape to reflect the portion of the FAB that intersects with it as it animates out.

It's a decent compromise for a fixed app bar with inset FAB, but the whole point of the inset FAB seems to be to support transitions and scrolling, so fixed doesn't make much sense.

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 8, 2018

Understood.

Regarding this current PR, is this PR okay to be merged?

@mbrookes
Copy link
Member

mbrookes commented Oct 8, 2018

Nearly. The sticky subheader shouldn’t have a transparent background, and now that the demo is in better shape, it also needs code review.

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 8, 2018

Done sir. Can you please review the code. @mbrookes

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

Okay, this is starting to look really good! A couple of typos in the messages, and a couple of nice-to-haves, and we're there!

{
id: 3,
primary: 'Recipe to try',
secondary: 'I am try out this new BaqBQ recipe, I think this might be amazing',
Copy link
Member

Choose a reason for hiding this comment

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

-new BaqBQ
+ new BBQ

},
{
id: 5,
primary: 'Doctors Appointment',
Copy link
Member

Choose a reason for hiding this comment

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

-Doctors
+Doctor's

{
id: 5,
primary: 'Doctors Appointment',
secondary: 'My appointment for the dentist was rescheduled for next Saturday.',
Copy link
Member

Choose a reason for hiding this comment

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

-dentist
+doctor

Inbox
</Typography>
<List className={classes.list}>
<ListSubheader className={classes.subHeader}>Today</ListSubheader>
Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to have a second sub-header for "Yesterday". You could add them conditionally above the ListItem based on the id, for example 'Today' before. 1, and 'Yesterday' before 3.

<ListSubheader className={classes.subHeader}>Today</ListSubheader>
{messages.map(({ id, primary, secondary }) => (
<ListItem key={id} button>
<Avatar alt="Remy Sharp" src="/static/images/remy.jpg" />
Copy link
Member

@mbrookes mbrookes Oct 8, 2018

Choose a reason for hiding this comment

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

Another nice-to-have, but perhaps we could have a couple more avatar images, and add the names to the messages object? Does the recipient only have one friend? 😆

-src="/static/images/remy.jpg"
+src="{`/static/images/${user}.jpg`}"

Copy link
Contributor Author

@adeelibr adeelibr Oct 9, 2018

Choose a reason for hiding this comment

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

There are only 2 images of people remy.jpg and uxceo-128.jpg in the images/ folder, Can I add more image assets in their, maybe the profile pictures of members of Material-UI?

@adeelibr
Copy link
Contributor Author

adeelibr commented Oct 9, 2018

This is how the updated demo looks at the moment.

puj2wku80k

I added my picture at the bottom, 😅 I hope it's okay. 😄

@mbrookes
Copy link
Member

mbrookes commented Oct 9, 2018

Haha.

Sure, why not one more. No need to add the whole team though, just assign those three to the messages at random.

Edit: just a thought though, do you have a color version for consistency with the others?

@adeelibr
Copy link
Contributor Author

I have updated the demo, can you kindly review again 😅

@mbrookes
Copy link
Member

This is going to seem very pedantic, but could you assign the avatars randomly 🎲 - it will look more natural.

@adeelibr
Copy link
Contributor Author

Sir I have updated the demo, is this better now? @mbrookes

@mbrookes
Copy link
Member

I was afraid that might happen if I didn't spell it out. My fault. 😅

Please revert to assigning them in the array, but randomly. i.e. not 1, 2, 3, 1, 2, 3...

I also notice a couple of other niggles:

  1. The spec says (paraphrasing) that when content overflows, it should be partially obscured, so that it's obvious that there is more content. At the moment the first two messages fit perfectly. Perhaps change the height of the demo, or reorder the messages so that you get 2 and a bit messages showing.

  2. The Paper needs to be square:

image

@adeelibr
Copy link
Contributor Author

I have updated the demo;

  • random images order
  • paper with square prop
  • increased the container height to show a bit more as suggested.

I have also synced this with the latest master branch.

@mbrookes mbrookes removed the PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI label Oct 11, 2018
@mbrookes
Copy link
Member

@adeelibr Nice job! Just compare the end result with the first draft. 👌

@adeelibr
Copy link
Contributor Author

@mbrookes thank you for being so helpful, with the code reviews. Working on Material-UI has been a great learning experience and with every code review and suggestion that I get from the team members here. I just improve a lot. So thank you for giving me an opportunity to work on this.

@mbrookes mbrookes added the docs Improvements or additions to the documentation label Oct 11, 2018
@mbrookes
Copy link
Member

@mui-org/core-contributors Any last comments?

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Some visual distinction between ListSubHeader and ListItem would be nice. Looks bad when text is scrolling below it. I think some divider below is sufficient.

@mbrookes
Copy link
Member

@eps1lon It's how the pinned sub-header behaves in the list demo. List sub-headers don't have a divider in the spec, although I couldn't see an example of pinned sub-headers. Lets park this for now, and keep the examples consistent.

Feel free to open an issue if you think we can improve the ListSubheader component.

@mbrookes mbrookes merged commit 7683886 into mui:master Oct 12, 2018
@mbrookes
Copy link
Member

🎉

@adeelibr adeelibr deleted the feature-appbar-bottom-demo branch October 12, 2018 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants