-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into personal_sign_e2e
- Loading branch information
Showing
20 changed files
with
830 additions
and
114 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
app/components/UI/Stake/components/UpsellBanner/UpsellBanner.styles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { Theme } from '../../../../../util/theme/models'; | ||
|
||
const upsellBannerStylesheet = (params: { theme: Theme }) => { | ||
const { theme } = params; | ||
const { colors } = theme; | ||
|
||
return StyleSheet.create({ | ||
container: { | ||
backgroundColor: colors.background.alternative, | ||
borderRadius: 8, | ||
gap: 8, | ||
alignItems: 'center', | ||
paddingVertical: 24, | ||
paddingHorizontal: 16, | ||
}, | ||
}); | ||
}; | ||
|
||
export default upsellBannerStylesheet; |
52 changes: 52 additions & 0 deletions
52
app/components/UI/Stake/components/UpsellBanner/UpsellBanner.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import UpsellBanner from '.'; | ||
import { | ||
UPSELL_BANNER_VARIANTS, | ||
UpsellBannerProps, | ||
} from './UpsellBanner.types'; | ||
import renderWithProvider from '../../../../../util/test/renderWithProvider'; | ||
import Button, { | ||
ButtonVariants, | ||
} from '../../../../../component-library/components/Buttons/Button'; | ||
|
||
describe('UpsellBanner', () => { | ||
const baseProps = { | ||
primaryText: 'you could earn', | ||
secondaryText: '$454', | ||
tertiaryText: 'per year on your tokens', | ||
endAccessory: ( | ||
<Button | ||
label={'Earn 4.5%'} | ||
variant={ButtonVariants.Secondary} | ||
onPress={jest.fn()} | ||
/> | ||
), | ||
}; | ||
|
||
describe('UpsellBannerHeader variant', () => { | ||
it('render matches screenshot', () => { | ||
const props: UpsellBannerProps = { | ||
variant: UPSELL_BANNER_VARIANTS.HEADER, | ||
...baseProps, | ||
}; | ||
|
||
const { toJSON } = renderWithProvider(<UpsellBanner {...props} />); | ||
|
||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('UpsellBannerBody variant', () => { | ||
it('render matches screenshot', () => { | ||
const props: UpsellBannerProps = { | ||
variant: UPSELL_BANNER_VARIANTS.BODY, | ||
onTooltipPress: jest.fn(), | ||
...baseProps, | ||
}; | ||
|
||
const { toJSON } = renderWithProvider(<UpsellBanner {...props} />); | ||
|
||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
app/components/UI/Stake/components/UpsellBanner/UpsellBanner.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export enum UPSELL_BANNER_VARIANTS { | ||
HEADER = 'HEADER', | ||
BODY = 'BODY', | ||
} | ||
|
||
interface UpsellBannerBaseProps { | ||
primaryText: string; | ||
secondaryText: string; | ||
tertiaryText: string; | ||
endAccessory?: React.ReactNode; | ||
} | ||
|
||
export type UpsellBannerHeaderProps = UpsellBannerBaseProps; | ||
|
||
export type UpsellBannerBodyProps = UpsellBannerBaseProps & { | ||
onTooltipPress: () => void; | ||
}; | ||
|
||
export type UpsellBannerProps = | ||
| (UpsellBannerHeaderProps & { variant: UPSELL_BANNER_VARIANTS.HEADER }) | ||
| (UpsellBannerBodyProps & { | ||
variant: UPSELL_BANNER_VARIANTS.BODY; | ||
}); |
32 changes: 32 additions & 0 deletions
32
app/components/UI/Stake/components/UpsellBanner/UpsellBannerBody/UpsellBannerBody.styles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { Theme } from '../../../../../../util/theme/models'; | ||
|
||
const styleSheet = (params: { theme: Theme }) => { | ||
const { theme } = params; | ||
const { colors } = theme; | ||
|
||
return StyleSheet.create({ | ||
container: { | ||
backgroundColor: colors.background.alternative, | ||
borderRadius: 8, | ||
gap: 8, | ||
paddingVertical: 12, | ||
paddingHorizontal: 16, | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}, | ||
left: { | ||
alignItems: 'flex-start', | ||
}, | ||
tooltipContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
gap: 4, | ||
}, | ||
right: { | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
}; | ||
|
||
export default styleSheet; |
52 changes: 52 additions & 0 deletions
52
app/components/UI/Stake/components/UpsellBanner/UpsellBannerBody/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import { TouchableOpacity, View } from 'react-native'; | ||
import styleSheet from './UpsellBannerBody.styles'; | ||
import { UpsellBannerBodyProps } from '../UpsellBanner.types'; | ||
import { useStyles } from '../../../../../hooks/useStyles'; | ||
import Text, { | ||
TextVariant, | ||
TextColor, | ||
} from '../../../../../../component-library/components/Texts/Text'; | ||
import Icon, { | ||
IconName, | ||
IconColor, | ||
IconSize, | ||
} from '../../../../../../component-library/components/Icons/Icon'; | ||
|
||
const UpsellBannerBody = ({ | ||
primaryText, | ||
secondaryText, | ||
tertiaryText, | ||
onTooltipPress, | ||
endAccessory, | ||
}: UpsellBannerBodyProps) => { | ||
const { styles } = useStyles(styleSheet, {}); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.left}> | ||
<Text variant={TextVariant.HeadingMD}>{primaryText}</Text> | ||
<Text variant={TextVariant.DisplayMD} color={TextColor.Success}> | ||
{secondaryText} | ||
</Text> | ||
<View style={styles.tooltipContainer}> | ||
<Text variant={TextVariant.BodyMD} color={TextColor.Alternative}> | ||
{tertiaryText} | ||
</Text> | ||
<TouchableOpacity onPress={onTooltipPress}> | ||
<Icon | ||
name={IconName.Info} | ||
size={IconSize.Sm} | ||
color={IconColor.Alternative} | ||
/> | ||
</TouchableOpacity> | ||
</View> | ||
</View> | ||
<View style={styles.right}> | ||
{React.isValidElement(endAccessory) && endAccessory} | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
export default UpsellBannerBody; |
20 changes: 20 additions & 0 deletions
20
...ponents/UI/Stake/components/UpsellBanner/UpsellBannerHeader/UpsellBannerHeader.styles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { StyleSheet } from 'react-native'; | ||
import { Theme } from '../../../../../../util/theme/models'; | ||
|
||
const styleSheet = (params: { theme: Theme }) => { | ||
const { theme } = params; | ||
const { colors } = theme; | ||
|
||
return StyleSheet.create({ | ||
container: { | ||
backgroundColor: colors.background.alternative, | ||
borderRadius: 8, | ||
gap: 8, | ||
paddingVertical: 24, | ||
paddingHorizontal: 16, | ||
alignItems: 'center', | ||
}, | ||
}); | ||
}; | ||
|
||
export default styleSheet; |
31 changes: 31 additions & 0 deletions
31
app/components/UI/Stake/components/UpsellBanner/UpsellBannerHeader/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import { UpsellBannerHeaderProps } from '../UpsellBanner.types'; | ||
import styleSheet from './UpsellBannerHeader.styles'; | ||
import { useStyles } from '../../../../../hooks/useStyles'; | ||
import Text, { | ||
TextVariant, | ||
TextColor, | ||
} from '../../../../../../component-library/components/Texts/Text'; | ||
|
||
const UpsellBannerHeader = ({ | ||
primaryText, | ||
secondaryText, | ||
tertiaryText, | ||
endAccessory, | ||
}: UpsellBannerHeaderProps) => { | ||
const { styles } = useStyles(styleSheet, {}); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text variant={TextVariant.HeadingMD}>{primaryText}</Text> | ||
<Text variant={TextVariant.DisplayMD} color={TextColor.Success}> | ||
{secondaryText} | ||
</Text> | ||
<Text color={TextColor.Alternative}>{tertiaryText}</Text> | ||
{React.isValidElement(endAccessory) && endAccessory} | ||
</View> | ||
); | ||
}; | ||
|
||
export default UpsellBannerHeader; |
Oops, something went wrong.