|
| 1 | +import React from 'react'; |
| 2 | +import { makeStyles } from '@material-ui/core/styles'; |
| 3 | +import PropTypes from 'prop-types'; |
| 4 | + |
| 5 | +import { Grid, Typography } from '@material-ui/core'; |
| 6 | + |
| 7 | +import coursesContent from 'src/data/courses'; |
| 8 | +import CourseCard from '../../../components/Course/CourseCardTemplate1'; |
| 9 | + |
| 10 | +const useStyles = makeStyles(theme => ({ |
| 11 | + icon: { |
| 12 | + marginRight: theme.spacing(2) |
| 13 | + }, |
| 14 | + root: { |
| 15 | + padding: theme.spacing(10, 10, 10), |
| 16 | + display: 'flex', |
| 17 | + justifyContent: 'center', |
| 18 | + alignItems: 'center', |
| 19 | + [theme.breakpoints.down('md')]: { |
| 20 | + padding: theme.spacing(10, 3, 10) |
| 21 | + } |
| 22 | + }, |
| 23 | + cardGrid: { |
| 24 | + paddingTop: theme.spacing(8), |
| 25 | + paddingBottom: theme.spacing(8) |
| 26 | + }, |
| 27 | + card: { |
| 28 | + height: '100%', |
| 29 | + display: 'flex', |
| 30 | + flexDirection: 'column', |
| 31 | + borderRadius: '10px', |
| 32 | + margin: '12px', |
| 33 | + boxShadow: '0px 0px 30px rgba(0, 0, 0, 0.13)' |
| 34 | + }, |
| 35 | + cardMedia: { |
| 36 | + width: '100%', |
| 37 | + height: 'auto' |
| 38 | + // paddingTop: "56.25%", // 16:9 |
| 39 | + }, |
| 40 | + cardContent: {}, |
| 41 | + chipActions: { |
| 42 | + display: 'block' |
| 43 | + }, |
| 44 | + chip: { |
| 45 | + margin: '8px 0 3px 8px' |
| 46 | + }, |
| 47 | + extraMargin: { |
| 48 | + marginTop: '15px', |
| 49 | + marginBottom: '0' |
| 50 | + }, |
| 51 | + btn: { |
| 52 | + textTransform: 'none' |
| 53 | + }, |
| 54 | + paddingCls: { |
| 55 | + paddingLeft: '10px', |
| 56 | + paddingRight: '10px' |
| 57 | + }, |
| 58 | + paddingClsxs: { |
| 59 | + padding: 0 |
| 60 | + }, |
| 61 | + iconSize: { |
| 62 | + fontSize: '32px' |
| 63 | + }, |
| 64 | + text: { |
| 65 | + color: '#FFFFFF' |
| 66 | + }, |
| 67 | + avatarLarge: { |
| 68 | + width: theme.spacing(16), |
| 69 | + height: theme.spacing(16), |
| 70 | + margin: theme.spacing(4, 0, 2) |
| 71 | + }, |
| 72 | + |
| 73 | + avatarGrid: { |
| 74 | + display: 'flex', |
| 75 | + flexDirection: 'column', |
| 76 | + alignItems: 'center', |
| 77 | + justifyContent: 'center', |
| 78 | + padding: '5px' |
| 79 | + }, |
| 80 | + |
| 81 | + slide: { |
| 82 | + perspective: 0, // create perspective |
| 83 | + overflow: 'hidden', |
| 84 | + // relative is a must if you want to create overlapping layers in children |
| 85 | + position: 'relative' |
| 86 | + }, |
| 87 | + background: { |
| 88 | + width: '100%', |
| 89 | + height: 'auto', |
| 90 | + backgroundPosition: 'bottom center', |
| 91 | + backgroundSize: 'cover' |
| 92 | + }, |
| 93 | + gridList: { |
| 94 | + flexWrap: 'wrap', |
| 95 | + width: '100%', |
| 96 | + // Promote the list into his own layer on Chrome. This cost memory but helps keeping high FPS. |
| 97 | + transform: 'translateZ(0)' |
| 98 | + } |
| 99 | +})); |
| 100 | + |
| 101 | +export default function Bootcamps() { |
| 102 | + const classes = useStyles(); |
| 103 | + |
| 104 | + const foundation = coursesContent.foundation; |
| 105 | + const advanced = coursesContent.advanced; |
| 106 | + |
| 107 | + return ( |
| 108 | + <Grid container className={classes.root}> |
| 109 | + <Grid item lg={12} md={12} sm={12} xs={12}> |
| 110 | + <Typography |
| 111 | + variant="h1" |
| 112 | + align="center" |
| 113 | + color="textPrimary" |
| 114 | + style={{ |
| 115 | + marginBottom: '20px' |
| 116 | + }} |
| 117 | + > |
| 118 | + Foundational Courses |
| 119 | + </Typography> |
| 120 | + </Grid> |
| 121 | + |
| 122 | + <Grid container> |
| 123 | + <Grid |
| 124 | + item |
| 125 | + lg={12} |
| 126 | + md={12} |
| 127 | + sm={12} |
| 128 | + xs={12} |
| 129 | + align="center" |
| 130 | + display="flex" |
| 131 | + justifyContent="center" |
| 132 | + alignItems="center" |
| 133 | + > |
| 134 | + <CoursesGrid courses={foundation} /> |
| 135 | + </Grid> |
| 136 | + </Grid> |
| 137 | + |
| 138 | + <Grid |
| 139 | + item |
| 140 | + lg={12} |
| 141 | + md={12} |
| 142 | + sm={12} |
| 143 | + xs={12} |
| 144 | + style={{ |
| 145 | + marginTop: '48px' |
| 146 | + }} |
| 147 | + > |
| 148 | + <Typography |
| 149 | + variant="h1" |
| 150 | + align="center" |
| 151 | + color="textPrimary" |
| 152 | + style={{ |
| 153 | + marginBottom: '20px' |
| 154 | + }} |
| 155 | + > |
| 156 | + Advanced Courses |
| 157 | + </Typography> |
| 158 | + </Grid> |
| 159 | + |
| 160 | + <Grid container> |
| 161 | + <Grid |
| 162 | + item |
| 163 | + lg={12} |
| 164 | + md={12} |
| 165 | + sm={12} |
| 166 | + xs={12} |
| 167 | + align="center" |
| 168 | + display="flex" |
| 169 | + justifyContent="center" |
| 170 | + alignItems="center" |
| 171 | + > |
| 172 | + <CoursesGrid courses={advanced} /> |
| 173 | + </Grid> |
| 174 | + </Grid> |
| 175 | + </Grid> |
| 176 | + ); |
| 177 | +} |
| 178 | + |
| 179 | +const CoursesGrid = ({ courses }) => { |
| 180 | + const classes = useStyles(); |
| 181 | + return ( |
| 182 | + <Grid |
| 183 | + container |
| 184 | + className={classes.gridList} |
| 185 | + style={{ |
| 186 | + justifyContent: 'center', |
| 187 | + alignItems: 'center' |
| 188 | + }} |
| 189 | + > |
| 190 | + {Object.entries(courses).map(([cname, course], index) => { |
| 191 | + return ( |
| 192 | + <Grid |
| 193 | + item |
| 194 | + key={course.id} |
| 195 | + lg={4} |
| 196 | + md={4} |
| 197 | + sm={6} |
| 198 | + xs={12} |
| 199 | + style={{ |
| 200 | + maxWidth: '320px' |
| 201 | + }} |
| 202 | + > |
| 203 | + <CourseCard course={course} /> |
| 204 | + </Grid> |
| 205 | + ); |
| 206 | + })} |
| 207 | + </Grid> |
| 208 | + ); |
| 209 | +}; |
| 210 | + |
| 211 | +function TabPanel(props) { |
| 212 | + const { children, value, index } = props; |
| 213 | + |
| 214 | + return ( |
| 215 | + <div role="tabpanel" hidden={value !== index}> |
| 216 | + <Grid container>{children}</Grid> |
| 217 | + </div> |
| 218 | + ); |
| 219 | +} |
| 220 | + |
| 221 | +TabPanel.propTypes = { |
| 222 | + children: PropTypes.node, |
| 223 | + index: PropTypes.any.isRequired, |
| 224 | + value: PropTypes.any.isRequired |
| 225 | +}; |
0 commit comments