forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSponsorCard.tsx
61 lines (60 loc) · 1.52 KB
/
SponsorCard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as React from 'react';
import Avatar from '@mui/material/Avatar';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Paper from '@mui/material/Paper';
import Link from 'docs/src/modules/components/Link';
import LaunchRounded from '@mui/icons-material/LaunchRounded';
export default function SponsorCard({
item,
inView = false,
logoSize = 40,
}: {
item: {
src: string;
srcSet: string;
name: string;
description: string;
href: string;
};
inView?: boolean;
logoSize?: number | string;
}) {
return (
<Paper
component={Link}
noLinkStyle
href={item.href}
target="_blank"
rel="sponsored noopener"
variant="outlined"
sx={{
p: 2,
display: 'flex',
height: '100%',
'& svg': {
transition: '0.2s',
},
'&:hover': {
'& svg': {
transform: 'translateY(-2px)',
},
},
}}
>
<Avatar
{...(inView && { src: item.src, srcSet: item.srcSet, alt: `${item.name} logo` })}
sx={{ borderRadius: '4px', width: logoSize, height: logoSize }}
/>
<Box sx={{ ml: 2 }}>
<Typography variant="body2" fontWeight="bold">
{item.name}{' '}
<LaunchRounded color="primary" sx={{ fontSize: 14, verticalAlign: 'middle', ml: 0.5 }} />
</Typography>
<Typography variant="body2" color="text.secondary">
{item.description}
</Typography>
</Box>
</Paper>
);
}