-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Layout] Add a new component #5808
Conversation
import classNames from 'classnames'; | ||
|
||
const GUTTERS = [8, 16, 24, 40]; | ||
const GIRD_SIZES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling
Looks good. Without using it my only concern is reducing verbosity where possible. For example: <LayoutBlock type="item" xsGrid={6} smGrid={3}> I think this would be better written as: <Layout xs={6} sm={3}> Details:
I think these would be good changes and will not reduce clarity given the frequency of use. |
@rosskevin Thanks for the feedback!
I completely agree.
That's a good idea.
You raised a good point. I wasn't happy with that
Bootstrap just dropped the |
@rosskevin I have updated the PR with your feedbacks.
I have tried to keep things simple. We should be able to continue the effort in a second run once we feel the needs for it. |
Hi @oliviertassinari, really nice start, here are a few questions/comment :
|
Good work @oliviertassinari ! I have one small question : why is the layout component not split into two distinct components ? Is there any practical reason the container and the item version should live together ? I didn't notice props that were used by the two components in your examples. Anyways, thank you for your work 👍 |
That's ambivalence is at the heart of the CSS’s flexbox model. Just reading the first line of the specification
So why not having two separate components?
That's basically adding
I have updated the documentation
Yes, that
I agree, as the previous answer. I want to keep thing simple to begin with. |
I now get it, |
}); | ||
}); | ||
|
||
describe('prop: component', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prop: xs
?
}); | ||
|
||
describe('prop: component', () => { | ||
it('should change the component', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also test spreading props properly to the component.
@oliviertassinari What are your thoughts RE the amount of styles that would be pre-created if Overall looking really awesome. |
@nathanmarks Thanks for the review. Regarding other set of properties that people might want to add, I see some candidates:
Or politic could be to let users implement the style in their side until we have a way to lazy inject the style or some benchmark showing us it's fine. |
Let's move forward. I'm gonna merge that PR. I'm quite happy with the API / implementation. |
Thanks everybody for your feedbacks! |
I tried with |
@gaguirre It isn't published yet, but you can find the code here: https://github.com/callemall/material-ui/tree/next |
Thanks @mbrookes, do you have plans to publish a new version soon? |
@nathanmarks might be working on automating releases of beta version of the |
Great! Thanks @oliviertassinari @mbrookes |
Hi @oliviertassinari I've been testing out this layout component and it’s really great - however, i’m just wondering how you would reference the xsAlign, xsDirection, xsJustify and xsWrap props (I can’t seem to figure it out and for me, it's not clear from your commits in the PR.) Including it like below, throws an error: <Layout type="item"
xs={6}
xsJustify="center"
xsAlign="center"
>
I've been looking for a comprehensive component based layout solution with React/flexbox and stumbled upon this - although it's ofc quite new, it seems to really fit the bill and would love to use it. Thanks. |
@Extra-lightwill Please open an issue. Have a look at that docs regarding how to use it https://material-ui-1dab0.firebaseapp.com/#/layout/responsive-ui. |
How about treating |
@rogovdm I'm wondering if |
@oliviertassinari maybe, but I'm not sure. I use Will there be much overhead if |
@rogovdm I get your tradeoff. I think we should wait having more feedbacks. |
I am starting a greenfields project using the next branch and I am currently looking for a good way to hide/render components based on screen size. For example, I might want to use a simplified logo on mobile but the full logo on desktop. Does Layout currently support a way of doing this, or am I thinking about the problem wrong? |
@jaredkwright No, he doesn't. I think that we could be providing a component / Higher-order Component for that use case. |
@oliviertassinari looks quite neat, is there a plan to backport it to <1.0.0 release? I tried the |
@mikeatm Thanks. No, we don't have the resources to maintained two versions same, we don't have the resource to give a ETA. |
I also attempted using it with the existing release - no dice, there is no styleManager in the existing release's MuiThemeProvider, but it is required to generate styles in the Layout class. Using two MuiThemeProviders from the existing release and next release, together, seems a bit unhealthy, not to mention it's quite hacky getting both existing and next working together. Is there any recommendation for a Layout that can be used /today/ with Material UI to allow automatic layouts, similar to the Material.io layouts? |
ran into this today, https://jsxmachina.github.io/react-grid-system/ , no idea if works, yet to test it with material-ui |
Yet another essential/cool thing... just in the next branch :( Great work as always guys! |
@damianobarbati It's published under the |
@oliviertassinari thanks so much for the quick answer, trying right now! Is there a documentation referring to the branch? I see lots has changed in components importing structure (icon, button) and theme (getMuiTheme not defined) and so on. |
I have linked the documentation in the previous comment. It's still work in progress. |
This is a port of the layout component we use at @doctolib.
We can see that effort as an alternative to #5267 that might or not succeed.
I have made some important API / implementation tradeoffs.
matchMedia
API to be fully server side rendering compliant. Eachxs
,sm
,md
andlg
variations increase the size of the style injected in the DOM.flex
property.<Col />
nor<Row />
components.Closes #3614