Skip to content

Commit 399d4b0

Browse files
feat(wallet-mobile): Create governance Yoroi delegation banner
1 parent 1f2788f commit 399d4b0

File tree

7 files changed

+173
-4
lines changed

7 files changed

+173
-4
lines changed

apps/wallet-mobile/.storybook/storybook.requires.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {action} from '@storybook/addon-actions'
2+
import {storiesOf} from '@storybook/react-native'
3+
import React from 'react'
4+
5+
import {ConsiderDelegatingToYoroiBanner} from './ConsiderDelegatingToYoroiBanner'
6+
7+
storiesOf('components/ConsiderDelegatingToYoroiBanner', module)
8+
.add('Default', () => <ConsiderDelegatingToYoroiBanner onPress={action('onPress')} />)
9+
.add('With Close Button', () => (
10+
<ConsiderDelegatingToYoroiBanner onPress={action('onPress')} onClose={action('onClose')} />
11+
))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import {useTheme} from '@yoroi/theme'
2+
import * as React from 'react'
3+
import {StyleSheet, TouchableOpacity, View} from 'react-native'
4+
import LinearGradient from 'react-native-linear-gradient'
5+
6+
import {Button} from '../../../components/Button/Button'
7+
import {Icon} from '../../../components/Icon'
8+
import {Text} from '../../../components/Text'
9+
import {useStrings} from './strings'
10+
11+
type Props = {
12+
onPress(): void
13+
onClose?(): void
14+
}
15+
16+
export const ConsiderDelegatingToYoroiBanner = ({onPress, onClose}: Props) => {
17+
const {styles, colors} = useStyles()
18+
const {title, description, cta} = useStrings()
19+
return (
20+
<LinearGradient start={{x: 1, y: 1}} end={{x: 0, y: 0}} colors={colors.gradient} style={styles.gradient}>
21+
<View style={styles.root}>
22+
{onClose && (
23+
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
24+
<Icon.Close color={colors.icon} size={20} />
25+
</TouchableOpacity>
26+
)}
27+
28+
<Text style={styles.title}>{title}</Text>
29+
30+
<Text style={styles.description}>{description}</Text>
31+
32+
<Button style={styles.primaryButton} type="Secondary" size="S" onPress={onPress} title={cta} />
33+
</View>
34+
</LinearGradient>
35+
)
36+
}
37+
38+
const useStyles = () => {
39+
const {color, atoms} = useTheme()
40+
const styles = StyleSheet.create({
41+
closeButton: {
42+
...atoms.absolute,
43+
right: atoms.px_lg.paddingRight,
44+
top: atoms.py_lg.paddingTop,
45+
width: 20,
46+
height: 20,
47+
zIndex: 1,
48+
},
49+
primaryButton: {
50+
...atoms.self_start,
51+
},
52+
gradient: {
53+
...atoms.relative,
54+
...atoms.rounded_sm,
55+
},
56+
root: {
57+
...atoms.py_lg,
58+
...atoms.px_lg,
59+
minHeight: 134,
60+
position: 'relative',
61+
},
62+
title: {
63+
color: color.gray_max,
64+
...atoms.font_semibold,
65+
...atoms.body_1_lg_medium,
66+
},
67+
description: {
68+
color: color.gray_max,
69+
...atoms.font_normal,
70+
...atoms.body_2_md_regular,
71+
...atoms.pb_lg,
72+
maxWidth: 279,
73+
},
74+
})
75+
76+
const colors = {
77+
gradient: color.bg_gradient_1,
78+
icon: color.gray_max,
79+
}
80+
81+
return {styles, colors}
82+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {defineMessages, useIntl} from 'react-intl'
2+
3+
export const useStrings = () => {
4+
const intl = useIntl()
5+
return {
6+
description: intl.formatMessage(messages.description),
7+
title: intl.formatMessage(messages.title),
8+
cta: intl.formatMessage(messages.cta),
9+
}
10+
}
11+
12+
const messages = defineMessages({
13+
description: {
14+
id: 'components.considerDelegatingToYoroiBanner.description',
15+
defaultMessage: '!!!Delegate to our DRep and help Cardano evolve in a way that benefits your wallet experience.',
16+
},
17+
title: {
18+
id: 'components.considerDelegatingToYoroiBanner.title',
19+
defaultMessage: '!!!Consider delegating to Yoroi',
20+
},
21+
cta: {
22+
id: 'components.considerDelegatingToYoroiBanner.cta',
23+
defaultMessage: '!!!Delegate Now',
24+
},
25+
})

apps/wallet-mobile/src/kernel/i18n/locales/en-US.json

+3
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@
504504
"components.settings.manageNotificationDisplayDuration.tenSeconds": "10s",
505505
"components.settings.manageNotificationDisplayDuration.twelveSeconds": "12s",
506506
"components.settings.manageNotificationDisplayDuration.inputError": "Enter a value from 1 to 60.",
507+
"components.considerDelegatingToYoroiBanner.description": "Delegate to our DRep and help Cardano evolve in a way that benefits your wallet experience.",
508+
"components.considerDelegatingToYoroiBanner.title": "Consider delegating to Yoroi",
509+
"components.considerDelegatingToYoroiBanner.cta": "Delegate Now",
507510
"components.somethingWentWrong.title": "Oops!",
508511
"components.somethingWentWrong.description": "Something went wrong.\nTry to reload this page or restart the app.",
509512
"components.stakingcenter.confirmDelegation.delegateButtonLabel": "Delegate",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"id": "components.considerDelegatingToYoroiBanner.description",
4+
"defaultMessage": "!!!Delegate to our DRep and help Cardano evolve in a way that benefits your wallet experience.",
5+
"file": "src/features/Banners/ConsiderDelegatingToYoroiBanner/strings.ts",
6+
"start": {
7+
"line": 13,
8+
"column": 15,
9+
"index": 327
10+
},
11+
"end": {
12+
"line": 16,
13+
"column": 3,
14+
"index": 516
15+
}
16+
},
17+
{
18+
"id": "components.considerDelegatingToYoroiBanner.title",
19+
"defaultMessage": "!!!Consider delegating to Yoroi",
20+
"file": "src/features/Banners/ConsiderDelegatingToYoroiBanner/strings.ts",
21+
"start": {
22+
"line": 17,
23+
"column": 9,
24+
"index": 527
25+
},
26+
"end": {
27+
"line": 20,
28+
"column": 3,
29+
"index": 647
30+
}
31+
},
32+
{
33+
"id": "components.considerDelegatingToYoroiBanner.cta",
34+
"defaultMessage": "!!!Delegate Now",
35+
"file": "src/features/Banners/ConsiderDelegatingToYoroiBanner/strings.ts",
36+
"start": {
37+
"line": 21,
38+
"column": 7,
39+
"index": 656
40+
},
41+
"end": {
42+
"line": 24,
43+
"column": 3,
44+
"index": 758
45+
}
46+
}
47+
]

apps/wallet-mobile/translations/messages/src/legacy/Dashboard/Dashboard.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"defaultMessage": "!!!Go to Staking Center",
55
"file": "src/legacy/Dashboard/Dashboard.tsx",
66
"start": {
7-
"line": 241,
7+
"line": 244,
88
"column": 23,
9-
"index": 7828
9+
"index": 8048
1010
},
1111
"end": {
12-
"line": 244,
12+
"line": 247,
1313
"column": 3,
14-
"index": 7961
14+
"index": 8181
1515
}
1616
}
1717
]

0 commit comments

Comments
 (0)