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

[ImageList] Refactor using CSS grid & React context #22395

Merged
merged 40 commits into from
Sep 12, 2020

Conversation

mbrookes
Copy link
Member

@mbrookes mbrookes commented Aug 28, 2020

Goodbye IE11?

  • Use CSS grid & columns for layout
  • Use CSS object-fit for image placement
  • Use React context in place of cloneElement for parent/child sync
  • Use react-testing-library for tests

Support:

  • Standard image list
  • Quilted image list
  • Woven image list (basic)
  • Masonry image list
  • Horizontal scroll Not included in this PR.
  • Bar below image

https://material.io/components/image-lists

Preview:

https://deploy-preview-22395--material-ui.netlify.app/components/image-list/

Additional breaking changes

  • Rename the GridList spacing prop to gap to align with the CSS attribute.
  • Rename the GridList cellHeight prop to rowHeight.
  • Add the variant prop to GridList.
  • Rename the GridListItemBar titlePosition prop to position. (Note also the related classname changes.)
-<ImageList spacing={8} cellHeight={200}>
  <ImageListItem>
+<ImageList gap={8} rowHeight={200}>
  <ImageListItem>
     <img src="file.jpg" alt="Image title" />
    <ImageListItemBar
-       titlePosition="top"
+       position="top"
       title="Title"
       subtitle="Subtitle"
     />
  </ImageListItem>
</ImageList>

Fix #19221

@mbrookes mbrookes added the component: image list This is the name of the generic UI component, not the React module! label Aug 28, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Aug 28, 2020

Details of bundle changes

Generated by 🚫 dangerJS against adb9d62

@mbrookes mbrookes force-pushed the imagelist-use-grid branch 2 times, most recently from 2d108f9 to 759ef67 Compare August 29, 2020 02:24
@oliviertassinari
Copy link
Member

Goodbye IE11?

Well, it depends on the features we need. There is a potential to make it work: https://css-tricks.com/css-grid-in-ie-debunking-common-ie-grid-misconceptions/. I have used https://autoprefixer.github.io/ in the past when doing a couple of tests with it.

@mbrookes
Copy link
Member Author

I have used https://autoprefixer.github.io/ in the past

object-fit would also need to be polyfilled, but that seems like a fair trade-off if someone must support IE, and won't use the V4 version.

@mnajdova
Copy link
Member

mnajdova commented Sep 3, 2020

We can use https://www.npmjs.com/package/object-fit-images for the polyfilling the object-fit if we need to

@mbrookes
Copy link
Member Author

mbrookes commented Sep 3, 2020

We can use https://www.npmjs.com/package/object-fit-images for the polyfilling the object-fit if we need to

Yes, I'd found that one too. I think we'd simply document it as a pre-req for using the 5.x image list with IE11.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Sep 4, 2020
@mbrookes mbrookes force-pushed the imagelist-use-grid branch 2 times, most recently from 0e6b5a3 to 5fe8a48 Compare September 4, 2020 16:50
@mbrookes
Copy link
Member Author

mbrookes commented Sep 9, 2020

My only outstanding concern is whether ImageListItemBar should be named ImageListItemTitlebar instead. The fact that the demo is called TitlebarImageList suggests that the component name is wrong.

@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 10, 2020

@mbrookes Anything missing to merge? I guess it comes down to, are we dropping IE 11 for the Image List component and what are the implications?

@mbrookes
Copy link
Member Author

mbrookes commented Sep 11, 2020

Yep, just wanted to do one more pass over the migration guide to pick up the additional breaking changes, and document IE11 prereqs, then I think we're good to go.

Edit: Also, as mentioned, I'm still wondering whether ImageListItemBar should be ImageListItemTitlebar instead; but perhaps it isn't important.

oliviertassinari added a commit to oliviertassinari/material-ui that referenced this pull request Sep 11, 2020
@mbrookes mbrookes merged commit 914cbf3 into mui:next Sep 12, 2020
@mbrookes mbrookes deleted the imagelist-use-grid branch September 12, 2020 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: image list This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Fragment> breaks <GridList> and <GridListTile> layout
5 participants