@@ -13,11 +13,11 @@ import { isExpandLine, mergeSegments, type InlineRenderInfo } from './utils/segm
13
13
14
14
interface ExpandLineRendererOptions {
15
15
/**
16
- * If this is `true`, you can show a "⬆️ Show xx lines" button
16
+ * If this is `true`, you can show a "⭡ Show xx lines before " button
17
17
*/
18
18
hasLinesBefore : boolean ;
19
19
/**
20
- * If this is `true`, you can show a "⬇️ Show xx lines" button
20
+ * If this is `true`, you can show a "⭣ Show xx lines after " button
21
21
*/
22
22
hasLinesAfter : boolean ;
23
23
/**
@@ -57,7 +57,7 @@ export type HideUnchangedLinesOptions = boolean | {
57
57
* default renderer will produce the following buttons in this line:
58
58
*
59
59
* ```text
60
- * [⬆️ Show 20 lines] [↕️ Show all unchanged lines] [⬇️ Show 20 lines]
60
+ * [⭡ Show 20 lines] [⭥ Show all unchanged lines] [⭣ Show 20 lines]
61
61
* ```
62
62
*/
63
63
expandLineRenderer ?: ( options ?: ExpandLineRendererOptions ) => JSX . Element ;
@@ -115,6 +115,12 @@ export interface ViewerProps {
115
115
texts ?: {
116
116
/** @default 'No change detected' */
117
117
noChangeDetected ?: string ;
118
+ /** @default '⭡ Show %d lines before', where %d is the number */
119
+ showLinesBefore ?: string ;
120
+ /** @default '⭣ Show %d lines after', where %d is the number */
121
+ showLinesAfter ?: string ;
122
+ /** @default '⭥ Show all unchanged lines' */
123
+ showAll ?: string ;
118
124
} ;
119
125
/** Extra class names */
120
126
className ?: string ;
@@ -126,6 +132,9 @@ const DEFAULT_INDENT = 2;
126
132
const DEFAULT_EXPAND_MORE_LINES_LIMIT = 20 ;
127
133
const DEFAULT_TEXTS = {
128
134
noChangeDetected : 'No change detected' ,
135
+ showLinesBefore : '⭡ Show %d lines before' ,
136
+ showLinesAfter : '⭣ Show %d lines after' ,
137
+ showAll : '⭥ Show all unchanged lines' ,
129
138
} ;
130
139
131
140
const Viewer : React . FC < ViewerProps > = props => {
@@ -362,17 +371,17 @@ const Viewer: React.FC<ViewerProps> = props => {
362
371
{
363
372
hasLinesBefore && (
364
373
< button onClick = { ( ) => onExpandBefore ( index ) ( expandMoreLinesLimit ) } >
365
- ⭡ Show { expandMoreLinesLimit } lines before
374
+ { mergedTexts . showLinesBefore . replaceAll ( '%d' , String ( expandMoreLinesLimit ) ) }
366
375
</ button >
367
376
)
368
377
}
369
378
< button onClick = { ( ) => onExpandAll ( index ) ( ) } >
370
- ⭥ Show all unchanged lines
379
+ { mergedTexts . showAll }
371
380
</ button >
372
381
{
373
382
hasLinesAfter && (
374
383
< button onClick = { ( ) => onExpandAfter ( index ) ( expandMoreLinesLimit ) } >
375
- ⭣ Show { expandMoreLinesLimit } lines after
384
+ { mergedTexts . showLinesAfter . replaceAll ( '%d' , String ( expandMoreLinesLimit ) ) }
376
385
</ button >
377
386
)
378
387
}
0 commit comments