1
1
import { prepareNativeStyle , useNativeStyles } from '@trezor/styles' ;
2
2
import { Translation , TxKeyPath } from '@suite-native/intl' ;
3
+ import { Color } from '@trezor/theme' ;
3
4
4
5
import { Box } from './Box' ;
5
6
import { HStack } from './Stack' ;
@@ -8,11 +9,13 @@ import { Text } from './Text';
8
9
type TextDividerProps = {
9
10
title : TxKeyPath ;
10
11
horizontalMargin ?: number ;
12
+ lineColor ?: Color ;
13
+ textColor ?: Color ;
11
14
} ;
12
15
13
- const separatorStyle = prepareNativeStyle < { horizontalMargin ?: number } > (
14
- ( utils , { horizontalMargin } ) => ( {
15
- backgroundColor : utils . colors . borderElevation0 ,
16
+ const separatorStyle = prepareNativeStyle < { horizontalMargin ?: number ; color : Color } > (
17
+ ( utils , { horizontalMargin, color } ) => ( {
18
+ backgroundColor : utils . colors [ color ] ,
16
19
height : utils . borders . widths . small ,
17
20
flex : 1 ,
18
21
// We want the separator to be full width, but we need to offset it by the parent padding
@@ -25,18 +28,23 @@ const separatorTitleStyle = prepareNativeStyle(utils => ({
25
28
paddingVertical : utils . spacings . extraSmall ,
26
29
} ) ) ;
27
30
28
- export const TextDivider = ( { title, horizontalMargin = 0 } : TextDividerProps ) => {
31
+ export const TextDivider = ( {
32
+ title,
33
+ horizontalMargin = 0 ,
34
+ lineColor = 'borderElevation1' ,
35
+ textColor = 'textDefault' ,
36
+ } : TextDividerProps ) => {
29
37
const { applyStyle } = useNativeStyles ( ) ;
30
38
31
39
return (
32
40
< HStack alignItems = "center" >
33
- < Box style = { applyStyle ( separatorStyle , { horizontalMargin } ) } />
41
+ < Box style = { applyStyle ( separatorStyle , { horizontalMargin, color : lineColor } ) } />
34
42
< Box style = { applyStyle ( separatorTitleStyle ) } >
35
- < Text variant = "label" >
43
+ < Text variant = "label" color = { textColor } >
36
44
< Translation id = { title } />
37
45
</ Text >
38
46
</ Box >
39
- < Box style = { applyStyle ( separatorStyle , { horizontalMargin } ) } />
47
+ < Box style = { applyStyle ( separatorStyle , { horizontalMargin, color : lineColor } ) } />
40
48
</ HStack >
41
49
) ;
42
50
} ;
0 commit comments