Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Commit 876bfe7

Browse files
OOPS: Finished making use of Wrapping
1 parent e28f8a1 commit 876bfe7

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

tyrian-next/src/main/scala/tyrian/ui/elements/stateless/link/LinkTheme.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import tyrian.ui.datatypes.RGBA
88
import tyrian.ui.datatypes.TextAlignment
99
import tyrian.ui.datatypes.TextDecoration
1010
import tyrian.ui.datatypes.TextStyle
11+
import tyrian.ui.datatypes.Wrapping
1112
import tyrian.ui.elements.stateless.text.TextTheme
1213
import tyrian.ui.theme.Theme
1314

@@ -34,8 +35,12 @@ final case class LinkTheme(
3435
def withLineHeight(value: LineHeight): LinkTheme =
3536
this.copy(base = base.withLineHeight(value))
3637

37-
def withWrap(value: Boolean): LinkTheme =
38-
this.copy(base = base.withWrap(value))
38+
def withWrapping(value: Wrapping): LinkTheme =
39+
this.copy(base = base.withWrapping(value))
40+
def noWrap: LinkTheme =
41+
withWrapping(Wrapping.NoWrap)
42+
def wrap: LinkTheme =
43+
withWrapping(Wrapping.Wrap)
3944

4045
def withStyle(value: TextStyle): LinkTheme =
4146
this.copy(base = base.withStyle(value))
@@ -77,9 +82,6 @@ final case class LinkTheme(
7782
def alignRight: LinkTheme = this.copy(base = base.alignRight)
7883
def alignJustify: LinkTheme = this.copy(base = base.alignJustify)
7984

80-
def wrap: LinkTheme = this.copy(base = base.wrap)
81-
def noWrap: LinkTheme = this.copy(base = base.noWrap)
82-
8385
def toStyles(theme: Theme): Style =
8486
base.toStyles(theme)
8587

@@ -102,7 +104,7 @@ object LinkTheme:
102104
textColor = RGBA.fromHex("#0066cc"), // Classic link blue..
103105
alignment = TextAlignment.Left,
104106
lineHeight = LineHeight.Normal,
105-
wrapping = true,
107+
wrapping = Wrapping.Wrap,
106108
style = TextStyle.Normal,
107109
decoration = TextDecoration.Underline // Links are underlined
108110
),

tyrian-next/src/main/scala/tyrian/ui/elements/stateless/text/TextTheme.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ final case class TextTheme(
5151
def withLineHeight(value: LineHeight): TextTheme =
5252
this.copy(lineHeight = value)
5353

54-
def withWrap(value: Wrapping): TextTheme =
54+
def withWrapping(value: Wrapping): TextTheme =
5555
this.copy(wrapping = value)
5656
def wrap: TextTheme =
57-
withWrap(Wrapping.Wrap)
57+
withWrapping(Wrapping.Wrap)
5858
def noWrap: TextTheme =
59-
withWrap(Wrapping.NoWrap)
59+
withWrapping(Wrapping.NoWrap)
6060

6161
def withStyle(value: TextStyle): TextTheme =
6262
this.copy(style = value)

tyrian-next/src/main/scala/tyrian/ui/elements/stateless/text/TextThemes.scala

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import tyrian.ui.datatypes.RGBA
77
import tyrian.ui.datatypes.TextAlignment
88
import tyrian.ui.datatypes.TextDecoration
99
import tyrian.ui.datatypes.TextStyle
10+
import tyrian.ui.datatypes.Wrapping
1011

1112
final case class TextThemes(
1213
normal: TextTheme,
@@ -102,7 +103,7 @@ object TextThemes:
102103
textColor = RGBA.fromHex("#333333"),
103104
alignment = TextAlignment.Left,
104105
lineHeight = LineHeight.Relaxed,
105-
wrapping = true,
106+
wrapping = Wrapping.Wrap,
106107
style = TextStyle.Normal,
107108
decoration = TextDecoration.None
108109
)
@@ -114,7 +115,7 @@ object TextThemes:
114115
textColor = RGBA.fromHex("#333333"),
115116
alignment = TextAlignment.Left,
116117
lineHeight = LineHeight.Relaxed,
117-
wrapping = true,
118+
wrapping = Wrapping.Wrap,
118119
style = TextStyle.Normal,
119120
decoration = TextDecoration.None
120121
)
@@ -126,7 +127,7 @@ object TextThemes:
126127
textColor = RGBA.fromHex("#1a1a1a"),
127128
alignment = TextAlignment.Left,
128129
lineHeight = LineHeight.Tight,
129-
wrapping = true,
130+
wrapping = Wrapping.Wrap,
130131
style = TextStyle.Normal,
131132
decoration = TextDecoration.None
132133
)
@@ -138,7 +139,7 @@ object TextThemes:
138139
textColor = RGBA.fromHex("#1a1a1a"),
139140
alignment = TextAlignment.Left,
140141
lineHeight = LineHeight.Tight,
141-
wrapping = true,
142+
wrapping = Wrapping.Wrap,
142143
style = TextStyle.Normal,
143144
decoration = TextDecoration.None
144145
)
@@ -150,7 +151,7 @@ object TextThemes:
150151
textColor = RGBA.fromHex("#1a1a1a"),
151152
alignment = TextAlignment.Left,
152153
lineHeight = LineHeight.Relative(1.3),
153-
wrapping = true,
154+
wrapping = Wrapping.Wrap,
154155
style = TextStyle.Normal,
155156
decoration = TextDecoration.None
156157
)
@@ -162,7 +163,7 @@ object TextThemes:
162163
textColor = RGBA.fromHex("#1a1a1a"),
163164
alignment = TextAlignment.Left,
164165
lineHeight = LineHeight.Relative(1.3),
165-
wrapping = true,
166+
wrapping = Wrapping.Wrap,
166167
style = TextStyle.Normal,
167168
decoration = TextDecoration.None
168169
)
@@ -174,7 +175,7 @@ object TextThemes:
174175
textColor = RGBA.fromHex("#1a1a1a"),
175176
alignment = TextAlignment.Left,
176177
lineHeight = LineHeight.Normal,
177-
wrapping = true,
178+
wrapping = Wrapping.Wrap,
178179
style = TextStyle.Normal,
179180
decoration = TextDecoration.None
180181
)
@@ -186,7 +187,7 @@ object TextThemes:
186187
textColor = RGBA.fromHex("#1a1a1a"),
187188
alignment = TextAlignment.Left,
188189
lineHeight = LineHeight.Normal,
189-
wrapping = true,
190+
wrapping = Wrapping.Wrap,
190191
style = TextStyle.Normal,
191192
decoration = TextDecoration.None
192193
)
@@ -198,7 +199,7 @@ object TextThemes:
198199
textColor = RGBA.fromHex("#666666"),
199200
alignment = TextAlignment.Left,
200201
lineHeight = LineHeight.Normal,
201-
wrapping = true,
202+
wrapping = Wrapping.Wrap,
202203
style = TextStyle.Normal,
203204
decoration = TextDecoration.None
204205
)
@@ -210,7 +211,7 @@ object TextThemes:
210211
textColor = RGBA.fromHex("#d73a49"),
211212
alignment = TextAlignment.Left,
212213
lineHeight = LineHeight.Normal,
213-
wrapping = false,
214+
wrapping = Wrapping.NoWrap,
214215
style = TextStyle.Normal,
215216
decoration = TextDecoration.None
216217
)
@@ -222,7 +223,7 @@ object TextThemes:
222223
textColor = RGBA.fromHex("#333333"),
223224
alignment = TextAlignment.Left,
224225
lineHeight = LineHeight.Normal,
225-
wrapping = false,
226+
wrapping = Wrapping.NoWrap,
226227
style = TextStyle.Normal,
227228
decoration = TextDecoration.None
228229
)

0 commit comments

Comments
 (0)