99import SwiftUI
1010
1111enum Typography {
12- case title
13- case titleBold
14- case subtitle
15- case subtitleBold
16- case body
17- case bodyBold
18- case button
19- case caption
12+ case displayTitle
13+ case displayBody
14+ case largeTitle
15+ case largeBody
16+ case mediumTitle
17+ case mediumBody
18+ case smallTitle
19+ case smallBody
20+ case extraSmallTitle
21+ case extraSmallBody
2022}
2123
2224extension Text {
2325 func style( _ typography: Typography ) -> Text {
2426 switch typography {
25- case . title: return title ( )
26- case . titleBold: return titleBold ( )
27- case . subtitle: return subtitle ( )
28- case . subtitleBold: return subtitleBold ( )
29- case . body: return body ( )
30- case . bodyBold: return bodyBold ( )
31- case . button: return button ( )
32- case . caption: return caption ( )
27+ case . displayTitle: return displayTitle ( )
28+ case . displayBody: return displayBody ( )
29+ case . largeTitle: return largeTitle ( )
30+ case . largeBody: return largeBody ( )
31+ case . mediumTitle: return mediumTitle ( )
32+ case . mediumBody: return mediumBody ( )
33+ case . smallTitle: return smallTitle ( )
34+ case . smallBody: return smallBody ( )
35+ case . extraSmallTitle: return extraSmallTitle ( )
36+ case . extraSmallBody: return extraSmallBody ( )
3337 }
3438 }
3539
36- private func title( ) -> Text {
37- self . font ( . system( size: 18 ) )
38- . foregroundColor ( . grayDark)
40+ private func displayTitle( ) -> Text {
41+ self . font ( . system( size: 19 ) )
42+ . foregroundColor ( . text1)
43+ . fontWeight ( . medium)
3944 }
4045
41- private func titleBold( ) -> Text {
42- self . title ( )
43- . bold ( )
46+ private func displayBody( ) -> Text {
47+ self . font ( . system( size: 19 ) )
48+ . foregroundColor ( . text1)
49+ . fontWeight ( . light)
4450 }
4551
46- private func subtitle( ) -> Text {
47- self . font ( . system( size: 16 ) )
48- . foregroundColor ( . grayDark)
52+ private func largeTitle( ) -> Text {
53+ self . font ( . system( size: 17 ) )
54+ . foregroundColor ( . text1)
55+ . fontWeight ( . medium)
4956 }
5057
51- private func subtitleBold( ) -> Text {
52- self . subtitle ( )
53- . bold ( )
58+ private func largeBody( ) -> Text {
59+ self . font ( . system( size: 17 ) )
60+ . foregroundColor ( . text1)
61+ . fontWeight ( . light)
5462 }
5563
56- private func body( ) -> Text {
64+ private func mediumTitle( ) -> Text {
65+ self . font ( . system( size: 15 ) )
66+ . foregroundColor ( . text1)
67+ . fontWeight ( . bold)
68+ }
69+
70+ private func mediumBody( ) -> Text {
5771 self . font ( . system( size: 14 ) )
58- . foregroundColor ( . grayDark)
72+ . foregroundColor ( . text1)
73+ . fontWeight ( . regular)
5974 }
6075
61- private func bodyBold( ) -> Text {
62- self . body ( )
63- . bold ( )
76+ private func smallTitle( ) -> Text {
77+ self . font ( . system( size: 13 ) )
78+ . foregroundColor ( . text1)
79+ . fontWeight ( . bold)
6480 }
6581
66- private func button( ) -> Text {
67- self . font ( . system( size: 14 ) )
68- . foregroundColor ( . grayDark)
82+ private func smallBody( ) -> Text {
83+ self . font ( . system( size: 13 ) )
84+ . foregroundColor ( . text1)
85+ . fontWeight ( . regular)
86+ }
87+
88+ private func extraSmallTitle( ) -> Text {
89+ self . font ( . system( size: 11 ) )
90+ . foregroundColor ( . text1)
91+ . fontWeight ( . bold)
6992 }
7093
71- private func caption( ) -> Text {
72- self . font ( . system( size: 12 ) )
73- . foregroundColor ( . grayDark)
94+ private func extraSmallBody( ) -> Text {
95+ self . font ( . system( size: 11 ) )
96+ . foregroundColor ( . text1)
97+ . fontWeight ( . regular)
7498 }
7599}
76100
@@ -84,22 +108,26 @@ internal struct Tipography_Previews: PreviewProvider {
84108 static var previews : some View {
85109 ScrollView {
86110 VStack ( spacing: 16 ) {
87- Text ( " title " )
88- . style ( . title)
89- Text ( " titleBold " )
90- . style ( . titleBold)
91- Text ( " subtitle " )
92- . style ( . subtitle)
93- Text ( " subtitleBold " )
94- . style ( . subtitleBold)
95- Text ( " body " )
96- . style ( . body)
97- Text ( " bodyBold " )
98- . style ( . bodyBold)
99- Text ( " button " )
100- . style ( . button)
101- Text ( " caption " )
102- . style ( . caption)
111+ Text ( " displayTitle " )
112+ . style ( . displayTitle)
113+ Text ( " displayBody " )
114+ . style ( . displayBody)
115+ Text ( " largeTitle " )
116+ . style ( . largeTitle)
117+ Text ( " largeBody " )
118+ . style ( . largeBody)
119+ Text ( " mediumTitle " )
120+ . style ( . mediumTitle)
121+ Text ( " mediumBody " )
122+ . style ( . mediumBody)
123+ Text ( " smallTitle " )
124+ . style ( . smallTitle)
125+ Text ( " smallBody " )
126+ . style ( . smallBody)
127+ Text ( " extraSmallTitle " )
128+ . style ( . extraSmallTitle)
129+ Text ( " extraSmallBody " )
130+ . style ( . extraSmallBody)
103131 }
104132 }
105133 }
0 commit comments