question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GridListTileBar add component prop

See original GitHub issue
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

GridListTileBar should accept TransitionComponent same as Dialog does

function Transition(props) {
  return <Slide direction="up" {...props} />;
}

Current Behavior 😯

GridListTileBar has no animation as seen on https://material-ui.com/demos/grid-list/#grid-list-with-titlebars

Examples 🌈

Gmail

Screen Shot 2019-05-17 at 5 19 36 PM

Context 🔦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
adeelibrcommented, Jun 10, 2019

I am so sorry for the late response @oliviertassinari but I didn’t understand your comment. About adding a Component prop since we can have the transition effect without adding this prop.

For this file docs\src\pages\components\grid-list\TitlebarGridList.js. I just wrapped GridListTileBar in Slide component and it works.

Codesandbox https://codesandbox.io/s/material-ui-example-gridlisttitlebar-rstr9

import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import GridList from '@material-ui/core/GridList';
import GridListTile from '@material-ui/core/GridListTile';
import GridListTileBar from '@material-ui/core/GridListTileBar';
import ListSubheader from '@material-ui/core/ListSubheader';
import IconButton from '@material-ui/core/IconButton';
import InfoIcon from '@material-ui/icons/Info';
import Slide from '@material-ui/core/Slide';
import tileData from './tileData';

const useStyles = makeStyles(theme => ({
  root: {
    display: 'flex',
    flexWrap: 'wrap',
    justifyContent: 'space-around',
    overflow: 'hidden',
    backgroundColor: theme.palette.background.paper,
  },
  gridList: {
    width: 500,
    height: 450,
  },
  icon: {
    color: 'rgba(255, 255, 255, 0.54)',
  },
}));

export default function TitlebarGridList() {
  const classes = useStyles();

  return (
    <div className={classes.root}>
      <GridList cellHeight={180} className={classes.gridList}>
        <GridListTile key="Subheader" cols={2} style={{ height: 'auto' }}>
          <ListSubheader component="div">December</ListSubheader>
        </GridListTile>
        {tileData.map(tile => (
          <GridListTile key={tile.img}>
            <img src={tile.img} alt={tile.title} />
            <Slide direction="up" in mountOnEnter unmountOnExit>
              <GridListTileBar
                title={tile.title}
                subtitle={<span>by: {tile.author}</span>}
                actionIcon={
                  <IconButton aria-label={`info about ${tile.title}`} className={classes.icon}>
                    <InfoIcon />
                  </IconButton>
                }
              />
            </Slide>
          </GridListTile>
        ))}
      </GridList>
    </div>
  );
}
0reactions
oliviertassinaricommented, Jun 11, 2019

@adeelibr Oh, right, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GridListTileBar add component prop #15734 - mui/material-ui
For this file docs\src\pages\components\grid-list\TitlebarGridList.js . I just wrapped GridListTileBar in Slide component and it works.
Read more >
GridListTileBar API - Material-UI
The API documentation of the GridListTileBar React component. Learn more about the properties and the CSS customization points.
Read more >
How to make the GridList component in React Material-UI ...
I want to make the grid responsive. The GridList component API has cols props, which by default is 2. For example, it could...
Read more >
React material UI tutorial 6 : Grid List component - YouTube
source code: https://webdevassist.com/reactjs-materialui/material-ui-gridlist-componentJoin my newsletter (☝️) to get updated on new ...
Read more >
Components and Props - React
Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. This page provides an introduction to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found