import "./App.css";
import * as React from "react";
import ImageList from "@mui/material/ImageList";
import ImageListItem from "@mui/material/ImageListItem";
import ImageListItemBar from "@mui/material/ImageListItemBar";
import { ThumbsUpDown, ThumbsUpDownRounded } from "@mui/icons-material";
import ThumbUpIcon from "@mui/icons-material/ThumbUp";
import { IconButton } from "@mui/material";
function srcset(image, size, rows = 1, cols = 1) {
return {
src: `${image}?w=${size * cols}
&h=${size * rows}&fit=crop&auto=format`,
srcSet: `${image}?w=${size * cols}&h=${size * rows
}&fit=crop&auto=format&dpr=2 2x`,
};
}
function App() {
return (
<div className="App">
<div
className="head"
style={{
width: "fit-content",
margin: "auto",
}}
>
<h1
style={{
color: "green",
}}
>
GeeksforGeeks
</h1>
<strong>React MUI ImageListItemBar API</strong>
</div>
<br />
<ImageList
sx={{ width: 900, height: 300, margin: "auto" }}
cols={4}
variant="quilted"
rowHeight={140}
>
<ImageListItem cols={1} rows={1}>
<img
{...srcset(
"https://media.geeksforgeeks.org/wp-content/uploads/20210915115837/gfg3-300x300.png",
121,
1,
1
)}
loading="lazy"
/>
<ImageListItemBar
title="GeeksforGeeks"
subtitle="A computer science portal for geeks."
actionIcon={
<IconButton sx={{ color: "lightgreen" }}>
<ThumbUpIcon />
</IconButton>
}
/>
</ImageListItem>
<ImageListItem cols={1} rows={1}>
<img
{...srcset(
"https://media.geeksforgeeks.org/wp-content/uploads/20210915115837/gfg3-300x300.png",
121,
1,
1
)}
loading="lazy"
/>
<ImageListItemBar
title="GeeksforGeeks"
subtitle="A computer science portal for geeks."
actionIcon={
<IconButton sx={{ color: "lightgreen" }}>
<ThumbUpIcon />
</IconButton>
}
/>
</ImageListItem>
<ImageListItem cols={1} rows={1}>
<img
{...srcset(
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png",
121,
1,
1
)}
loading="lazy"
/>
<ImageListItemBar
title="GeeksforGeeks Logo"
subtitle="A computer science portal for geeks."
actionIcon={
<IconButton sx={{ color: "lightgreen" }}>
<ThumbUpIcon />
</IconButton>
}
/>
</ImageListItem>
<ImageListItem cols={3} rows={1}>
<img
{...srcset(
"https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210420155809/gfg-new-logo.png",
121,
3,
1
)}
loading="lazy"
/>
<ImageListItemBar
title="GeeksforGeeks New Logo"
subtitle="A computer science portal for geeks."
actionIcon={
<IconButton sx={{ color: "lightgreen" }}>
<ThumbUpIcon />
</IconButton>
}
/>
</ImageListItem>
<ImageListItem cols={1} rows={1}>
<img
{...srcset(
"https://media.geeksforgeeks.org/wp-content/uploads/20210915115837/gfg3-300x300.png",
121,
1,
1
)}
loading="lazy"
/>
<ImageListItemBar
title="GeeksforGeeks"
subtitle="A computer science portal for geeks."
actionIcon={
<IconButton sx={{ color: "lightgreen" }}>
<ThumbUpIcon />
</IconButton>
}
/>
</ImageListItem>
</ImageList>
</div>
);
}
export default App;