|
| 1 | +package com.eatssu.android.presentation.compose.ui.theme |
| 2 | + |
| 3 | +import androidx.compose.runtime.Composable |
| 4 | +import androidx.compose.runtime.Stable |
| 5 | +import androidx.compose.ui.text.TextStyle |
| 6 | +import androidx.compose.ui.text.font.Font |
| 7 | +import androidx.compose.ui.text.font.FontFamily |
| 8 | +import androidx.compose.ui.text.font.FontWeight |
| 9 | +import androidx.compose.ui.text.style.LineHeightStyle |
| 10 | +import androidx.compose.ui.unit.TextUnit |
| 11 | +import androidx.compose.ui.unit.sp |
| 12 | +import com.eatssu.android.R |
| 13 | + |
| 14 | +// ํฐํธ ํจ๋ฐ๋ฆฌ ์ค์ |
| 15 | +val pretendardBold = FontFamily(Font(R.font.pretendard_bold, FontWeight.Bold)) |
| 16 | +val pretendardMedium = FontFamily(Font(R.font.pretendard_medium, FontWeight.Medium)) |
| 17 | +val pretendardSemiBold = FontFamily(Font(R.font.pretendard_semibold, FontWeight.SemiBold)) |
| 18 | +val pretendardRegular = FontFamily(Font(R.font.pretendard_regular, FontWeight.Normal)) |
| 19 | + |
| 20 | +@Stable |
| 21 | +class EatssuTypography internal constructor( |
| 22 | + val button1: TextStyle, |
| 23 | + val button2: TextStyle, |
| 24 | + val headingPrimary: TextStyle, |
| 25 | + val headingSecondary: TextStyle, |
| 26 | + val subtitle1: TextStyle, |
| 27 | + val subtitle2: TextStyle, |
| 28 | + val body1: TextStyle, |
| 29 | + val body2: TextStyle, |
| 30 | + val body3: TextStyle, |
| 31 | + val caption1: TextStyle, |
| 32 | + val caption2: TextStyle, |
| 33 | +) { |
| 34 | + fun copy(): EatssuTypography = EatssuTypography( |
| 35 | + button1, button2, headingPrimary, headingSecondary, subtitle1, subtitle2, body1, body2, body3, caption1, caption2 |
| 36 | + ) |
| 37 | +} |
| 38 | + |
| 39 | +fun EatssuTextStyle( |
| 40 | + fontFamily: FontFamily, |
| 41 | + fontWeight: FontWeight = FontWeight.Normal, |
| 42 | + fontSize: TextUnit, |
| 43 | + lineHeight: TextUnit, |
| 44 | +): TextStyle = TextStyle( |
| 45 | + fontFamily = fontFamily, |
| 46 | + fontWeight = fontWeight, |
| 47 | + fontSize = fontSize, |
| 48 | + lineHeight = lineHeight, |
| 49 | + lineHeightStyle = LineHeightStyle( |
| 50 | + alignment = LineHeightStyle.Alignment.Center, |
| 51 | + trim = LineHeightStyle.Trim.None |
| 52 | + ) |
| 53 | +) |
| 54 | + |
| 55 | +@Composable |
| 56 | +fun eatssuTypography(): EatssuTypography { |
| 57 | + return EatssuTypography( |
| 58 | + button1 = EatssuTextStyle( |
| 59 | + fontFamily = pretendardBold, |
| 60 | + fontSize = 18.sp, |
| 61 | + lineHeight = 24.sp |
| 62 | + ), |
| 63 | + button2 = EatssuTextStyle( |
| 64 | + fontFamily = pretendardBold, |
| 65 | + fontSize = 14.sp, |
| 66 | + lineHeight = 20.sp |
| 67 | + ), |
| 68 | + headingPrimary = EatssuTextStyle( |
| 69 | + fontFamily = pretendardBold, |
| 70 | + fontSize = 20.sp, |
| 71 | + lineHeight = 30.sp |
| 72 | + ), |
| 73 | + headingSecondary = EatssuTextStyle( |
| 74 | + fontFamily = pretendardBold, |
| 75 | + fontSize = 18.sp, |
| 76 | + lineHeight = 28.sp |
| 77 | + ), |
| 78 | + subtitle1 = EatssuTextStyle( |
| 79 | + fontFamily = pretendardSemiBold, |
| 80 | + fontSize = 16.sp, |
| 81 | + lineHeight = 24.sp |
| 82 | + ), |
| 83 | + subtitle2 = EatssuTextStyle( |
| 84 | + fontFamily = pretendardSemiBold, |
| 85 | + fontSize = 16.sp, |
| 86 | + lineHeight = 22.sp |
| 87 | + ), |
| 88 | + body1 = EatssuTextStyle( |
| 89 | + fontFamily = pretendardRegular, |
| 90 | + fontSize = 16.sp, |
| 91 | + lineHeight = 24.sp |
| 92 | + ), |
| 93 | + body2 = EatssuTextStyle( |
| 94 | + fontFamily = pretendardRegular, |
| 95 | + fontSize = 14.sp, |
| 96 | + lineHeight = 20.sp |
| 97 | + ), |
| 98 | + body3 = EatssuTextStyle( |
| 99 | + fontFamily = pretendardRegular, |
| 100 | + fontSize = 14.sp, |
| 101 | + lineHeight = 18.sp |
| 102 | + ), |
| 103 | + caption1 = EatssuTextStyle( |
| 104 | + fontFamily = pretendardBold, |
| 105 | + fontSize = 12.sp, |
| 106 | + lineHeight = 16.sp |
| 107 | + ), |
| 108 | + caption2 = EatssuTextStyle( |
| 109 | + fontFamily = pretendardMedium, |
| 110 | + fontSize = 12.sp, |
| 111 | + lineHeight = 16.sp |
| 112 | + ) |
| 113 | + ) |
| 114 | +} |
0 commit comments