blob: e749d10fb225056b3db52addf63adbd8860bba03 (
plain)
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
|
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Image from './Image';
interface PropTypes {
src?: string;
alt?: string;
}
const useStyles = makeStyles({
root: {
position: 'absolute',
width: '100%',
height: '100%'
},
image: {
objectFit: 'cover',
pointerEvents: 'none',
width: '100%',
height: '100%'
}
});
const BackgroundImage: React.FC<PropTypes> = ({ src, alt }) => {
const classes = useStyles();
return (
<picture className={classes.root}>
<Image src={src} alt={alt} className={classes.image} />
</picture>
);
};
export default BackgroundImage;
|