Skip to content

Commit b33119b

Browse files
committed
feat(suite): Redesign Troubleshooting tips
1 parent fceefbc commit b33119b

File tree

3 files changed

+44
-62
lines changed

3 files changed

+44
-62
lines changed

packages/suite/src/components/suite/troubleshooting/TroubleshootingTips.tsx

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,21 @@ import {
44
Banner,
55
BannerVariant,
66
Box,
7+
Button,
78
Card,
8-
Collapsible,
99
Column,
10-
ElevationContext,
11-
ElevationDown,
12-
ElevationUp,
1310
IconName,
11+
Modal,
1412
Row,
1513
SelectBar,
1614
Text,
1715
} from '@trezor/components';
1816
import { spacings } from '@trezor/theme';
1917

20-
import { TroubleshootingTipsFooter } from './TroubleshootingTipsFooter';
2118
import { TroubleshootingTipsList } from './TroubleshootingTipsList';
22-
import { TroubleshootingTipsToggle } from './TroubleshootingTipsToggle';
2319
import { useLayoutSize } from '../../../hooks/suite';
20+
import { Translation } from '../Translation';
21+
import { TroubleshootingTipsFooter } from './TroubleshootingTipsFooter';
2422

2523
export type TroubleshootingTipsItem = {
2624
key: string;
@@ -106,47 +104,53 @@ export const TroubleshootingTipsWithSections = <K extends string, T extends K>({
106104
);
107105
};
108106

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+
)}
138142
</Column>
139-
</Collapsible>
140-
);
143+
);
144+
};
141145

142146
return cta ? (
143147
<Column gap={80} alignItems="center">
144148
<ActionBanner />
145-
<CollapsibleTroubleshooting />
149+
<TroubleshootingButton />
146150
</Column>
147151
) : (
148152
<Box margin={{ top: 80 }}>
149-
<CollapsibleTroubleshooting />
153+
<TroubleshootingButton />
150154
</Box>
151155
);
152156
};

packages/suite/src/components/suite/troubleshooting/TroubleshootingTipsFooter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const TroubleshootingTipsFooter = () => {
1515
justifyContent="space-between"
1616
gap={spacings.xs}
1717
alignItems="center"
18+
width="100%"
1819
>
1920
<Text typographyStyle="hint">
2021
<Translation id="TR_ONBOARDING_TROUBLESHOOTING_FAILED" />

packages/suite/src/components/suite/troubleshooting/TroubleshootingTipsToggle.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)