-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement billing banner #43267
implement billing banner #43267
Changes from all commits
bdd0adc
58fe381
2487592
94f0a01
f0e23c9
0dd74d7
5ffec6f
1baaae0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import Icon from '@components/Icon'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import Text from '@components/Text'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
|
||
type BillingBannerProps = { | ||
title?: string; | ||
subtitle?: string; | ||
isError?: boolean; | ||
shouldShowRedDotIndicator?: boolean; | ||
isTrialActive?: boolean; | ||
}; | ||
|
||
function BillingBanner({title, subtitle, isError, shouldShowRedDotIndicator, isTrialActive}: BillingBannerProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
|
||
const backgroundStyle = isTrialActive ? styles.trialBannerBackgroundColor : styles.hoveredComponentBG; | ||
|
||
const subtitleStyle = isTrialActive ? [] : styles.textSupporting; | ||
|
||
return ( | ||
<View style={[styles.pv4, styles.ph5, styles.flexRow, styles.gap3, styles.w100, styles.alignItemsCenter, backgroundStyle]}> | ||
<Icon | ||
src={isError ? Illustrations.CreditCardEyes : Illustrations.CheckmarkCircle} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the icon should be passed as a prop. Because we're planning to reuse this for RBR from other API failures like change of subscription plan There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or may be I am getting confused. This banner is specific to the Card section? and the other RBRs will be handled as different implementation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not need to pass here icon as a prop, for BRB pattern we will pass the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, currently, this banner is specific There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant for all the errors it'll always show There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can update this to be more reusable and make it less specific in the future when it would be needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine with that. |
||
width={variables.menuIconSize} | ||
height={variables.menuIconSize} | ||
/> | ||
<View style={[styles.flex1, styles.justifyContentCenter]}> | ||
{title && <Text style={[styles.textStrong]}>{title}</Text>} | ||
{subtitle && <Text style={subtitleStyle}>{subtitle}</Text>} | ||
</View> | ||
{isError && shouldShowRedDotIndicator && ( | ||
<Icon | ||
src={Expensicons.DotIndicator} | ||
fill={theme.danger} | ||
/> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
BillingBanner.displayName = 'BillingBanner'; | ||
|
||
export default BillingBanner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Expensify/design Would we have a case where we might not want to show any icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's confirm with @dannymcclain for this one too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently do not have any cases where we don't have an icon. And playing around with it in Figma, the icon really contributes a lot to the layout so I'm inclined to say we should always include one.