2024-03-28 09:20:40 +00:00
|
|
|
import Box from "@mui/material/Box";
|
|
|
|
import { FC } from "react";
|
|
|
|
import DeleteIcon from "@mui/icons-material/Delete";
|
|
|
|
import { IconButton, SxProps, Theme } from "@mui/material";
|
|
|
|
|
|
|
|
type VideoElementProps = {
|
|
|
|
videoSrc: string;
|
2024-03-28 10:52:24 +00:00
|
|
|
width?: string;
|
2024-03-28 09:20:40 +00:00
|
|
|
theme: Theme;
|
|
|
|
onDeleteClick: () => void;
|
|
|
|
deleteIconSx?: SxProps<Theme>;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const VideoElement: FC<VideoElementProps> = ({
|
|
|
|
videoSrc,
|
2024-03-28 10:52:24 +00:00
|
|
|
width = "300",
|
2024-03-28 09:20:40 +00:00
|
|
|
theme,
|
|
|
|
onDeleteClick,
|
|
|
|
deleteIconSx,
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<Box sx={{ position: "relative", width: `${width}px` }}>
|
2024-03-28 10:52:24 +00:00
|
|
|
<video
|
|
|
|
style={{ borderRadius: "8px" }}
|
|
|
|
src={videoSrc}
|
|
|
|
width={width}
|
|
|
|
controls
|
|
|
|
/>
|
2024-03-28 09:20:40 +00:00
|
|
|
<IconButton
|
|
|
|
onClick={onDeleteClick}
|
|
|
|
sx={{
|
|
|
|
position: "absolute",
|
|
|
|
right: 0,
|
|
|
|
top: 0,
|
|
|
|
color: theme.palette.orange.main,
|
|
|
|
borderRadius: "8px",
|
|
|
|
borderBottomRightRadius: 0,
|
|
|
|
borderTopLeftRadius: 0,
|
|
|
|
...deleteIconSx,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<DeleteIcon />
|
|
|
|
</IconButton>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
};
|