Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/mobile/src/components/PanelButton/PanelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export const PanelButton = (props: PanelButtonProps) => {
<PWText
style={themeStyle.textStyle}
variant={titleWeight}
// Keep the title on one line when a badge sits
// beside it — on higher-density devices the
// scaled title + badge would otherwise wrap.
truncate={!!badge}
{...getTestProps(testID, 'text')}
>
{title}
Expand Down Expand Up @@ -109,7 +113,14 @@ export const PanelButton = (props: PanelButtonProps) => {
}}
{...getTestProps(testID, 'learn_more')}
>
<PWText variant='link'>{learnMore.label}</PWText>
{/*
linkPositive keeps the teal link tone in both
themes (link's dark tone is the brand yellow),
per the Quantum "Learn more" design.
*/}
<PWText variant='linkPositive'>
{learnMore.label}
</PWText>
</PWTouchableOpacity>
)}
</PWView>
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/components/core/PWBadge/PWBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Badge, type BadgeProps } from '@rneui/themed'
import { useStyles } from './styles'

export type PWBadgeProps = {
variant?: 'primary' | 'testnet' | 'secondary' | 'positive' | 'alert'
variant?: 'primary' | 'testnet' | 'secondary' | 'positive' | 'alert' | 'new'
} & BadgeProps

export const PWBadge = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ describe('PWBadge', () => {
)
expect(screen.getByText('3')).toBeTruthy()
})

it('renders new variant value correctly', () => {
render(
<PWBadge
variant='new'
value='NEW'
/>,
)
expect(screen.getByText('NEW')).toBeTruthy()
})
})
5 changes: 5 additions & 0 deletions apps/mobile/src/components/core/PWBadge/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const useStyles = makeStyles((theme, props: PWBadgeProps) => {
} else if (variant === 'positive') {
textColor = theme.colors.positive
backgroundColor = theme.colors.buttonSquareBg
} else if (variant === 'new') {
// Solid "NEW feature" highlight pill (e.g. Quantum accounts) — mint
// fill with dark text, per the Wallet/4 design tokens.
textColor = theme.colors.wallet4Icon
backgroundColor = theme.colors.wallet4
} else if (variant === 'alert') {
textColor = theme.colors.textWhite
backgroundColor = theme.colors.alertNegative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const useAddAccountScreen = () => {
badge: {
labelKey:
'onboarding.add_account.quantum_account_option_badge',
variant: 'positive',
variant: 'new',
},
learnMore: {
labelKey:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,15 @@ registerPreview({
/>
),
},
{
label: 'new',
node: (
<PWBadge
value='NEW'
variant='new'
/>
),
},
]}
/>
),
Expand Down
Loading