|
| 1 | +import { css } from "@emotion/react"; |
| 2 | + |
| 3 | +import { AppTheme } from "@/theme"; |
| 4 | +import { lineClamp } from "@/utils/styles/line-clamp"; |
| 5 | + |
| 6 | +const Constants = { |
| 7 | + titleLineCount: 2, |
| 8 | + descLineCount: 2, |
| 9 | +}; |
| 10 | + |
| 11 | +export const styles = { |
| 12 | + root: (theme: AppTheme) => |
| 13 | + css({ |
| 14 | + display: "grid", |
| 15 | + gridTemplateColumns: `1fr auto auto`, |
| 16 | + gridTemplateRows: "auto auto minmax(0, 1fr) auto", |
| 17 | + gridTemplateAreas: `\ |
| 18 | + "title . thumb" |
| 19 | + "date . thumb" |
| 20 | + "description . thumb" |
| 21 | + "divider divider divider" |
| 22 | + `, |
| 23 | + marginBlockStart: theme.spacing(4), |
| 24 | + marginBlockEnd: theme.spacing(2), |
| 25 | + height: theme.spacing(20), |
| 26 | + [theme.breakpoints.down("md")]: { |
| 27 | + height: theme.spacing(22), |
| 28 | + }, |
| 29 | + overflow: "hidden", |
| 30 | + }), |
| 31 | + |
| 32 | + title: (theme: AppTheme) => |
| 33 | + css({ |
| 34 | + gridArea: "title", |
| 35 | + marginInlineEnd: theme.spacing(2), |
| 36 | + color: theme.palette.text.primary, |
| 37 | + ...lineClamp( |
| 38 | + Constants.titleLineCount, |
| 39 | + theme.typography.h6.fontSize!, |
| 40 | + theme.typography.h6.lineHeight!, |
| 41 | + ), |
| 42 | + }), |
| 43 | + |
| 44 | + date: css({ |
| 45 | + gridArea: "date", |
| 46 | + }), |
| 47 | + |
| 48 | + description: (theme: AppTheme) => |
| 49 | + css({ |
| 50 | + gridArea: "description", |
| 51 | + marginBlockStart: theme.spacing(2), |
| 52 | + marginInlineEnd: theme.spacing(2), |
| 53 | + color: theme.palette.text.secondary, |
| 54 | + ...lineClamp( |
| 55 | + Constants.descLineCount, |
| 56 | + theme.typography.body1.fontSize!, |
| 57 | + theme.typography.body1.lineHeight!, |
| 58 | + ), |
| 59 | + }), |
| 60 | + |
| 61 | + thumb: (theme: AppTheme) => |
| 62 | + css({ |
| 63 | + gridArea: "thumb", |
| 64 | + width: theme.spacing(15), |
| 65 | + height: theme.spacing(15), |
| 66 | + objectFit: "cover", |
| 67 | + objectPosition: "center", |
| 68 | + backgroundColor: theme.palette.augmentColor({ |
| 69 | + color: { |
| 70 | + main: theme.palette.background.paper, |
| 71 | + }, |
| 72 | + }).light, |
| 73 | + }), |
| 74 | + |
| 75 | + divider: (theme: AppTheme) => |
| 76 | + css({ |
| 77 | + gridArea: "divider", |
| 78 | + paddingBlockStart: theme.spacing(2), |
| 79 | + }), |
| 80 | +}; |
0 commit comments