@@ -4,23 +4,21 @@ import {
4
4
Banner ,
5
5
BannerVariant ,
6
6
Box ,
7
+ Button ,
7
8
Card ,
8
- Collapsible ,
9
9
Column ,
10
- ElevationContext ,
11
- ElevationDown ,
12
- ElevationUp ,
13
10
IconName ,
11
+ Modal ,
14
12
Row ,
15
13
SelectBar ,
16
14
Text ,
17
15
} from '@trezor/components' ;
18
16
import { spacings } from '@trezor/theme' ;
19
17
20
- import { TroubleshootingTipsFooter } from './TroubleshootingTipsFooter' ;
21
18
import { TroubleshootingTipsList } from './TroubleshootingTipsList' ;
22
- import { TroubleshootingTipsToggle } from './TroubleshootingTipsToggle' ;
23
19
import { useLayoutSize } from '../../../hooks/suite' ;
20
+ import { Translation } from '../Translation' ;
21
+ import { TroubleshootingTipsFooter } from './TroubleshootingTipsFooter' ;
24
22
25
23
export type TroubleshootingTipsItem = {
26
24
key : string ;
@@ -106,47 +104,53 @@ export const TroubleshootingTipsWithSections = <K extends string, T extends K>({
106
104
) ;
107
105
} ;
108
106
109
- const CollapsibleTroubleshooting = ( ) => (
110
- < Collapsible
111
- defaultIsOpen = { initiallyIsOpen === true }
112
- data-testid = { dataTest || '@onboarding/expand-troubleshooting-tips' }
113
- >
114
- < Column gap = { 20 } alignItems = "center" >
115
- < Collapsible . Toggle >
116
- < TroubleshootingTipsToggle > { toggleText } </ TroubleshootingTipsToggle >
117
- </ Collapsible . Toggle >
118
- < Collapsible . Content >
119
- < ElevationContext baseElevation = { - 1 } >
120
- < ElevationDown >
121
- < Card paddingType = "small" maxWidth = "656px" >
122
- < Column gap = { spacings . sm } >
123
- { labelRow }
124
- { /* Custom design, where upper card is -1, and this card is 1 */ }
125
- < ElevationUp >
126
- < Card >
127
- < TroubleshootingTipsList
128
- items = { items [ selectedSection ] . items }
129
- />
130
- </ Card >
131
- </ ElevationUp >
132
- < TroubleshootingTipsFooter />
133
- </ Column >
134
- </ Card >
135
- </ ElevationDown >
136
- </ ElevationContext >
137
- </ Collapsible . Content >
107
+ const TroubleshootingButton = ( ) => {
108
+ const [ isTroubleshootingModalVisible , setIsTroubleshootingModalVisible ] = useState ( false ) ;
109
+ const onOpen = ( ) => {
110
+ setIsTroubleshootingModalVisible ( true ) ;
111
+ } ;
112
+ const onCancel = ( ) => {
113
+ setIsTroubleshootingModalVisible ( false ) ;
114
+ } ;
115
+
116
+ return (
117
+ < Column
118
+ alignItems = "center"
119
+ data-testid = { dataTest || '@onboarding/expand-troubleshooting-tips' }
120
+ >
121
+ < Button
122
+ onClick = { onOpen }
123
+ variant = "info"
124
+ size = "small"
125
+ isSubtle = { ! initiallyIsOpen }
126
+ icon = "question"
127
+ >
128
+ { toggleText ?? < Translation id = "TR_TROUBLE_SHOOTING_TIPS" /> }
129
+ </ Button >
130
+ { isTroubleshootingModalVisible && (
131
+ < Modal
132
+ heading = { toggleText ?? < Translation id = "TR_TROUBLE_SHOOTING_TIPS" /> }
133
+ onCancel = { onCancel }
134
+ variant = "info"
135
+ bottomContent = { < TroubleshootingTipsFooter /> }
136
+ >
137
+ < Card header = { labelRow } >
138
+ < TroubleshootingTipsList items = { items [ selectedSection ] . items } />
139
+ </ Card >
140
+ </ Modal >
141
+ ) }
138
142
</ Column >
139
- </ Collapsible >
140
- ) ;
143
+ ) ;
144
+ } ;
141
145
142
146
return cta ? (
143
147
< Column gap = { 80 } alignItems = "center" >
144
148
< ActionBanner />
145
- < CollapsibleTroubleshooting />
149
+ < TroubleshootingButton />
146
150
</ Column >
147
151
) : (
148
152
< Box margin = { { top : 80 } } >
149
- < CollapsibleTroubleshooting />
153
+ < TroubleshootingButton />
150
154
</ Box >
151
155
) ;
152
156
} ;
0 commit comments