-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathindex.jsx
More file actions
108 lines (97 loc) · 3.04 KB
/
Copy pathindex.jsx
File metadata and controls
108 lines (97 loc) · 3.04 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
=========================================================
* Material Dashboard 2 React - v2.2.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
// react-router components
import { Link } from "react-router-dom";
// prop-types is a library for typechecking of props
import PropTypes from "prop-types";
// @mui material components
import Card from "@mui/material/Card";
import MuiLink from "@mui/material/Link";
// Material Dashboard 2 React components
import MDBox from "components/MDBox";
import MDTypography from "components/MDTypography";
import MDButton from "components/MDButton";
function SimpleBlogCard({ image, title, description, action }) {
return (
<Card>
<MDBox position="relative" borderRadius="lg" mt={-3} mx={2}>
<MDBox
component="img"
src={image}
alt={title}
borderRadius="lg"
shadow="md"
width="100%"
height="100%"
position="relative"
zIndex={1}
/>
<MDBox
borderRadius="lg"
shadow="md"
width="100%"
height="100%"
position="absolute"
left={0}
top="3%"
sx={{
backgroundImage: `url(${image})`,
transform: "scale(0.94)",
filter: "blur(12px)",
backgroundSize: "cover",
}}
/>
</MDBox>
<MDBox p={3}>
<MDTypography display="inline" variant="h3" textTransform="capitalize" fontWeight="bold">
{title}
</MDTypography>
<MDBox mt={2} mb={3}>
<MDTypography variant="body2" component="p" color="text">
{description}
</MDTypography>
</MDBox>
{action.type === "external" ? (
<MuiLink href={action.route} target="_blank" rel="noreferrer">
<MDButton color={action.color ? action.color : "dark"}>{action.label}</MDButton>
</MuiLink>
) : (
<Link to={action.route}>
<MDButton color={action.color ? action.color : "dark"}>{action.label}</MDButton>
</Link>
)}
</MDBox>
</Card>
);
}
// Typechecking props for the SimpleBlogCard
SimpleBlogCard.propTypes = {
image: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
action: PropTypes.shape({
type: PropTypes.oneOf(["external", "internal"]).isRequired,
route: PropTypes.string.isRequired,
color: PropTypes.oneOf([
"primary",
"secondary",
"info",
"success",
"warning",
"error",
"dark",
"light",
"default",
]),
label: PropTypes.string.isRequired,
}).isRequired,
};
export default SimpleBlogCard;