Skip to content

Commit a4802a1

Browse files
authored
fix line clamping of HTML description (#1967)
* in the drawer description: remove max-height clamping fallback, unnecessary white-space rule, hide empty elements * only enable max-height rule in browsers that don't support line clamp
1 parent 1850731 commit a4802a1

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

frontends/ol-components/src/components/LearningResourceExpanded/LearningResourceExpandedV2.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,17 @@ const Description = styled.p({
174174
...theme.typography.body2,
175175
color: theme.custom.colors.black,
176176
margin: 0,
177-
whiteSpace: "pre-wrap",
178177
wordBreak: "break-word",
179-
"p:first-child": {
180-
marginTop: 0,
181-
},
182-
"p:last-child": {
183-
marginBottom: 0,
178+
"> *": {
179+
":first-child": {
180+
marginTop: 0,
181+
},
182+
":last-child": {
183+
marginBottom: 0,
184+
},
185+
":empty": {
186+
display: "none",
187+
},
184188
},
185189
})
186190

@@ -189,6 +193,7 @@ const DescriptionCollapsed = styled(Description)({
189193
overflow: "hidden",
190194
maxHeight: `calc(${theme.typography.body2.lineHeight} * 5)`,
191195
"@supports (-webkit-line-clamp: 5)": {
196+
maxHeight: "unset",
192197
WebkitLineClamp: 5,
193198
WebkitBoxOrient: "vertical",
194199
},

0 commit comments

Comments
 (0)