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

[theme] Add border-radius to the theme #11847

Merged
merged 2 commits into from
Jun 25, 2018
Merged

Conversation

itelo
Copy link
Contributor

@itelo itelo commented Jun 13, 2018

Add to theme defaults borderRadius and use it internally. Then we can change globally the radius of components.

Since a lot of components are based in Paper, we just need to create borderRadius.paper and borderRadius.button, following that we apply the borderRadius to:

  • Paper
  • Drawer
  • Card
  • Popover
  • Button
  • Table
  • Dialog

closes #11725

@oliviertassinari oliviertassinari self-assigned this Jun 17, 2018
@oliviertassinari oliviertassinari added new feature New feature or request design: material This is about Material Design, please involve a visual or UX designer in the process labels Jun 23, 2018
@oliviertassinari oliviertassinari changed the title Add border-radius to theme [theme] Add border-radius to the theme Jun 23, 2018
@oliviertassinari
Copy link
Member

@itelo Thanks for the first iteration! I have reversed the approach. We try to keep the theme object as generic as possible by default (not tight to any component). For component related customization, people can use the theme.overrides.x a feature of the theme.
I have been browsing the specification, the Material Design Team seems to have simplified the border-radius story. I could only find 4px.

Following the Bootstrap approach and tailwind CSS, I think that we can expose different values by default to ease the process of building more component. Well, to be challenged:

const borderRadius = {
  small: 2,
  medium: 4,
  large: 6,
};

@oliviertassinari oliviertassinari force-pushed the border-radius branch 3 times, most recently from 996a05d to d168a19 Compare June 23, 2018 12:10
@mbrookes
Copy link
Member

I'm not convinced of the benefit of having small, medium and large.

  1. The border-radius should normally be consistent across components.
  2. Changing "medium" in the theme to something other than 4 (for example 0 (see "Sharp components", means the name no longer makes sense.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 23, 2018

The border-radius should normally be consistent across components.

Isn't what these properties are for: using consistent values?

Changing "medium" in the theme to something other than 4 (for example 0 (see "Sharp components", means the name no longer makes sense.

What's wrong with someone setting?:

const theme = createMuiTheme({
  borderRadius: {
    small: 0,
    medium: 0,
    large: 0,
  },
};

Ok, maybe we should be having a single value?

const borderRadius = {
  medium: 4,
};

or

const borderRadius = {
  default: 4,
};

@@ -49,18 +49,10 @@ export const styles = theme => ({
left: 0,
right: 'auto',
},
paperAnchorLeftRounded: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created this to give to everyone the option to use drawer/sidebars that should be square and use the same component with just square = false, to use sheets like the images below

image

image

Copy link
Member

Choose a reason for hiding this comment

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

@itelo Can we work on it in a different pull-request? Do you have a reference in the specification? I can't find it in https://material.io/design/components/sheets-side.html.

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, and we could also add it in docs. I didn't find either.

Copy link

@Melancholism Melancholism Oct 31, 2023

Choose a reason for hiding this comment

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

@oliviertassinari @itelo I think shape is not included in the docs yet.

Also, how can I set border-radius on different window sizes? Thanks.

@oliviertassinari
Copy link
Member

@mbrookes I'm not sure how to handle this case. Maybe with a custom value?
capture d ecran 2018-06-23 a 15 46 13

@mbrookes
Copy link
Member

const borderRadius = {
  default: 4,
};

Is better, although then I wonder if it needs the default key? Why not just borderRadius in that case?

Also, should it be a root key, or is there some broader category this should be grouped under?

@itelo
Copy link
Contributor Author

itelo commented Jun 23, 2018

@oliviertassinari there are some problems if we choose to use medium, large, small.

  • if we use the medium by default, and we want big borderRadius like 25px, snackbars will have big borderRadius, and I'm pretty sure the snackbar cannot have it all on borderRadius.
  • snackbar, paper and others component (in your PR) used to have 2px of borderRadius, now they have 4, is that ok?

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 23, 2018

Is better, although then I wonder if it needs the default key? Why not just borderRadius in that case?

@mbrookes So people can grow the list of possible border-radius value in their custom theme if they want?

snackbar, paper and others component (in your PR) used to have 2px of borderRadius, now they have 4, is that ok?

@itelo The change was made to follow the specification.

if we use the medium by default, and we want big borderRadius like 25px, snackbars will have big borderRadius, and I'm pretty sure the snackbar cannot have it all on borderRadius.

I'm not sure to follow the point. What do you suggest?

@oliviertassinari oliviertassinari removed their assignment Jun 23, 2018
@mbrookes
Copy link
Member

So people can grow the list of possible border-radius value in their custom theme if they want?

Okay, cool. Im still wondering whether it should be a root key (what if we want cornerStyle or some such at some point?), but I don't have any better suggestion.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 23, 2018

Should we rename theme.borderRadius.default to theme.shape.borderRadius? It's more room to grow in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design: material This is about Material Design, please involve a visual or UX designer in the process new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants