diff --git a/src/components/ClassCard.js b/src/components/ClassCard.js
deleted file mode 100644
index ad6e534..0000000
--- a/src/components/ClassCard.js
+++ /dev/null
@@ -1,144 +0,0 @@
-import {
- Card,
- CardContent,
- Typography,
- CardActionArea,
- Container,
- Avatar,
- Stack,
- AvatarGroup,
- Tooltip,
-} from '@mui/material';
-
-function ClassCard({
- abbreviation,
- title,
- color,
- teachers,
- layoutType,
- onClick,
-}) {
- if (layoutType === 'desktop') {
- return (
-
- onClick()}
- sx={{ display: 'flex', flexDirection: 'row' }}
- >
-
- {abbreviation}
-
-
-
- {title}
-
-
-
- {teachers.map(t => (
-
- ))}
-
- t.name).join(', ')}>
-
- {teachers.map(t => t.name).join(', ')}
-
-
-
-
-
-
- );
- } else if (layoutType === 'mobile') {
- return (
-
- onClick()}
- sx={{ display: 'flex', flexDirection: 'column' }}
- >
-
- {abbreviation}
-
-
-
- {title}
-
-
-
- {teachers.map(t => (
-
- ))}
-
-
- {teachers.map(t => t.name).join(', ')}
-
-
-
-
-
- );
- }
-}
-
-export default ClassCard;
diff --git a/src/components/ClassCard/index.js b/src/components/ClassCard/index.js
new file mode 100644
index 0000000..79bf495
--- /dev/null
+++ b/src/components/ClassCard/index.js
@@ -0,0 +1,107 @@
+import {
+ Card,
+ CardContent,
+ Typography,
+ CardActionArea,
+ Container,
+ Avatar,
+ Stack,
+ AvatarGroup,
+ Tooltip,
+} from '@mui/material';
+
+import styles from './styles';
+
+function ClassCard({
+ abbreviation,
+ title,
+ color,
+ teachers,
+ layoutType,
+ onClick,
+}) {
+ const {
+ cardContainer,
+ cardActionArea,
+ abbreviationContainer,
+ cardContent,
+ titleContainer,
+ avatar,
+ tooltip,
+ } = styles[layoutType];
+ if (layoutType === 'desktop') {
+ return (
+
+ onClick()} sx={cardActionArea}>
+
+ {abbreviation}
+
+
+
+ {title}
+
+
+
+ {teachers.map(t => (
+
+ ))}
+
+ t.name).join(', ')}>
+
+ {teachers.map(t => t.name).join(', ')}
+
+
+
+
+
+
+ );
+ } else if (layoutType === 'mobile') {
+ return (
+
+ onClick()} sx={cardActionArea}>
+
+ {abbreviation}
+
+
+
+ {title}
+
+
+
+ {teachers.map(t => (
+
+ ))}
+
+
+ {teachers.map(t => t.name).join(', ')}
+
+
+
+
+
+ );
+ }
+}
+
+export default ClassCard;
diff --git a/src/components/ClassCard/styles.js b/src/components/ClassCard/styles.js
new file mode 100644
index 0000000..5c13e1f
--- /dev/null
+++ b/src/components/ClassCard/styles.js
@@ -0,0 +1,116 @@
+// ========== Desktop ==========
+const desktopCardContainer = {
+ width: 390,
+ height: 135,
+};
+const desktopCardActionArea = {
+ display: 'flex',
+ flexDirection: 'row',
+};
+
+const desktopAbbreviationContainer = color => ({
+ backgroundColor: color,
+ width: '35%',
+ height: '145px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ color: 'white',
+});
+
+const desktopCardContent = {
+ width: '70%',
+};
+
+const desktopTitleContainer = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+ fontSize: '17px',
+};
+
+const desktopAvatar = {
+ width: 30,
+ height: 30,
+};
+
+const desktopTooltip = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+};
+
+const desktop = {
+ cardContainer: desktopCardContainer,
+ cardActionArea: desktopCardActionArea,
+ abbreviationContainer: desktopAbbreviationContainer,
+ cardContent: desktopCardContent,
+ titleContainer: desktopTitleContainer,
+ avatar: desktopAvatar,
+ tooltip: desktopTooltip,
+};
+
+// ========== Mobile ==========
+const mobileCardContainer = {
+ width: '100%',
+};
+
+const mobileCardActionArea = {
+ display: 'flex',
+ flexDirection: 'column',
+};
+
+const mobileAbbreviationContainer = color => ({
+ backgroundColor: color,
+ width: '100%',
+ height: '145px',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ color: 'white',
+});
+
+const mobileCardContent = {
+ width: '100%',
+};
+
+const mobileAvatar = {
+ width: 30,
+ height: 30,
+};
+
+const mobileTooltip = {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ display: '-webkit-box',
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: 'vertical',
+};
+
+const mobile = {
+ cardContainer: mobileCardContainer,
+ cardActionArea: mobileCardActionArea,
+ abbreviationContainer: mobileAbbreviationContainer,
+ cardContent: mobileCardContent,
+ titleContainer: null,
+ avatar: mobileAvatar,
+ tooltip: mobileTooltip,
+};
+
+// ========== Unset ==========
+const unset = {
+ cardContainer: null,
+ cardActionArea: null,
+ abbreviationContainer: null,
+ cardContent: null,
+ titleContainer: null,
+ avatar: null,
+ tooltip: null,
+};
+
+const styles = { desktop, mobile, unset };
+export default styles;