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] Switch order of snackbar buttons in demos #37389

Merged
merged 9 commits into from
Jun 20, 2023

Conversation

Primajin
Copy link
Contributor

@Primajin Primajin commented May 24, 2023

Before

Screenshot 2023-06-20 at 23 21 59

https://deploy-preview-37387--material-ui.netlify.app/material-ui/react-snackbar/#positioned-snackbars

After

Screenshot 2023-06-20 at 23 20 59

https://deploy-preview-37389--material-ui.netlify.app/material-ui/react-snackbar/#positioned-snackbars

explanation

I find it more logical when we go from left to right, that also left comes first and then right comes next.

Switch left and right, so left comes first and right comes later when reading left to right

Signed-off-by: Jannis Hell <[email protected]>
@mui-bot
Copy link

mui-bot commented May 24, 2023

Netlify deploy preview

https://deploy-preview-37389--material-ui.netlify.app/

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against d0a8be5

@ZeeshanTamboli ZeeshanTamboli added docs Improvements or additions to the documentation component: snackbar This is the name of the generic UI component, not the React module! labels May 24, 2023
@zannager zannager requested a review from siriwatknp May 24, 2023 13:28
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

I find it more logical when we go from left to right, that also left comes first and then right comes next.

Why is it considered more logical? Can you provide an explanation, or is it simply a matter of personal preference?

@Primajin
Copy link
Contributor Author

The buttons to spawn the Snackbar on the left of the screen are positioned on the right. The buttons to show it on the right, are on the left.

It feels more natural to put the button also on the side where the snackbar will appear.

Same goes for the example further down:
Screenshot 2023-05-25 at 10 31 06

Right is on the left side, left is further right...

A more positive example is the positioned tooltips:
https://mui.com/material-ui/react-tooltip/#positioned-tooltips

Screenshot 2023-05-25 at 10 33 17

Left is left, up is up, right is right and down is down - that's what feels logical and natural to me.

@Primajin
Copy link
Contributor Author

Maybe it makes more sense to align it in a plus shape like we have at positioned tooltips? I'm happy to come up with a proposed change if you think that would clear things up - also for consistency it might be nice to align with the way tooltips shows it.

@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented May 25, 2023

I'll leave the decision to @danilo-leal, @zanivan.

@zanivan
Copy link
Contributor

zanivan commented May 25, 2023

The current flow is meant to be clockwise, starting from top-center—and it makes the right buttons stay on the left side 😅

As I see, the best way to fix this is to make it like the tooltips, as @Primajin said. This way, users can navigate clockwise, and also see the left buttons on the left and vice versa—and keep it consistent with we already have on the tooltip page.

@Primajin
Copy link
Contributor Author

Alright cool, then I'll look into that and ping you once the change is made 👍🏻

@Primajin Primajin marked this pull request as draft May 25, 2023 13:38
Switch left and right, so left comes first and right comes later when reading left to right

Signed-off-by: Jannis Hell <[email protected]>
@Primajin
Copy link
Contributor Author

Primajin commented Jun 3, 2023

How about this:

Screenshot 2023-06-03 162524
Screenshot 2023-06-03 162539

@Primajin Primajin marked this pull request as ready for review June 3, 2023 14:32
@Primajin
Copy link
Contributor Author

Primajin commented Jun 3, 2023

Can you help me understand what the failing test is trying to tell me?

When I run it locally I get:

> yarn docs:typescript:formatted
yarn run v1.22.19
$ cross-env BABEL_ENV=development babel-node --extensions ".tsx,.ts,.js" ./docs/scripts/formattedTSDemos
C:\[...]\material-ui\packages\typescript-to-proptypes\src\index.ts:1
import * as ts from 'typescript';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1175:20)
    at Module._compile (node:internal/modules/cjs/loader:1219:27)
    at Module._compile (C:\[...]\material-ui\node_modules\pirates\lib\index.js:136:24)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Object.newLoader [as .ts] (C:\[...]\material-ui\node_modules\pirates\lib\index.js:141:7)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)

Node.js v20.2.0
error Command failed with exit code 1.

@Primajin Primajin requested a review from ZeeshanTamboli June 10, 2023 19:02
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Jun 14, 2023

@Primajin That's strange. I tried locally using the same version of Node.js 20.2.0 and it worked. Maybe you could try merging the latest master branch, running yarn install in the root directory, and giving it another try. However, I have already pushed the changes.

@zanivan @danilo-leal Can you review?

@zanivan
Copy link
Contributor

zanivan commented Jun 14, 2023

It's looking good! Just tweaked the demo a bit, to be more similar to the one we have for tooltips.

@ZeeshanTamboli
Copy link
Member

@zanivan Feel free to approve and merge the PR if it looks good.

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Looks good! I fixed some code in 89356cc to use textAlign instead of flex column positioning.

@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Switch order of positioned snackbar buttons [docs] Switch order of snackbar buttons Jun 20, 2023
@ZeeshanTamboli ZeeshanTamboli added the package: material-ui Specific to @mui/material label Jun 20, 2023
@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Switch order of snackbar buttons [docs] Switch order of snackbar buttons in demos Jun 20, 2023
@ZeeshanTamboli ZeeshanTamboli added the enhancement This is not a bug, nor a new feature label Jun 20, 2023
@ZeeshanTamboli ZeeshanTamboli merged commit 840975c into mui:master Jun 20, 2023
@Primajin Primajin deleted the patch-1 branch June 20, 2023 13:43
@Primajin
Copy link
Contributor Author

Thanks folks! 🙌🏻

@oliviertassinari
Copy link
Member

I have done a follow-up in #37657 this PR broke the layout in mobile:

Screenshot 2023-06-20 at 23 29 57

https://deploy-preview-37389--material-ui.netlify.app/material-ui/react-snackbar/#positioned-snackbars

@Primajin
Copy link
Contributor Author

Ahh thanks, I thought I had tested everything on mobile but maybe some of the later changes that came in broke it 😱

@ZeeshanTamboli
Copy link
Member

I forgot to test for mobile screens. Thanks for the follow up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: snackbar This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants