@@ -8,13 +8,15 @@ import parse, {
8
8
} from "html-react-parser" ;
9
9
import { useHydratedMemo } from "~/useHydrated" ;
10
10
import { Link } from "@remix-run/react" ;
11
- import { GooeyHelpIcon , TooltipPlacement } from "./components/GooeyTooltip" ;
11
+ import type { TooltipPlacement } from "./components/GooeyTooltip" ;
12
+ import { GooeyHelpIcon } from "./components/GooeyTooltip" ;
12
13
13
14
export function RenderedHTML ( {
14
15
body,
15
16
lineClamp,
16
17
help,
17
18
tooltipPlacement,
19
+ lineClampExpand,
18
20
...attrs
19
21
} : {
20
22
body : string ;
@@ -42,7 +44,7 @@ export function RenderedHTML({
42
44
) ;
43
45
}
44
46
return (
45
- < LineClamp lines = { lineClamp } key = { body } >
47
+ < LineClamp lines = { lineClamp } key = { body } expandable = { lineClampExpand } >
46
48
< span className = "gui-html-container" { ...attrs } >
47
49
{ parsedElements }
48
50
</ span >
@@ -141,9 +143,11 @@ const reactParserOptions: HTMLReactParserOptions = {
141
143
function LineClamp ( {
142
144
lines,
143
145
children,
146
+ expandable = true ,
144
147
} : {
145
148
lines ?: number ;
146
149
children : React . ReactNode ;
150
+ expandable : boolean ;
147
151
} ) {
148
152
const contentRef = useRef < HTMLSpanElement > ( null ) ;
149
153
@@ -201,19 +205,21 @@ function LineClamp({
201
205
lineHeight : "130%" ,
202
206
} }
203
207
>
204
- < button
205
- style = { {
206
- border : "none" ,
207
- backgroundColor : "white" ,
208
- color : "rgba(0, 0, 0, 0.6)" ,
209
- } }
210
- type = { "button" }
211
- onClick = { ( ) => {
212
- setExpanded ( true ) ;
213
- } }
214
- >
215
- …more
216
- </ button >
208
+ { expandable && (
209
+ < button
210
+ style = { {
211
+ border : "none" ,
212
+ backgroundColor : "white" ,
213
+ color : "rgba(0, 0, 0, 0.6)" ,
214
+ } }
215
+ type = { "button" }
216
+ onClick = { ( ) => {
217
+ setExpanded ( true ) ;
218
+ } }
219
+ >
220
+ …more
221
+ </ button >
222
+ ) }
217
223
</ span >
218
224
) }
219
225
</ span >
0 commit comments