-
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 4 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,44 @@ | ||
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'; | ||
|
||
type BillingBannerProps = { | ||
title: string; | ||
subtitle: string; | ||
isError?: boolean; | ||
shouldShowRedDotIndicator?: boolean; | ||
}; | ||
|
||
function BillingBanner({title, subtitle, isError, shouldShowRedDotIndicator}: BillingBannerProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<View style={[styles.pt4, styles.pb3, styles.ph5, styles.flexRow, styles.gap3, styles.w100, styles.alignItemsCenter, styles.hoveredComponentBG]}> | ||
<Icon | ||
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. @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 commentThe 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 commentThe 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. |
||
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={48} | ||
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. Let's reuse existing variable sizes for example 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. updated with reuse |
||
height={48} | ||
/> | ||
<View style={[styles.flex1, styles.justifyContentCenter]}> | ||
<Text style={[styles.headerText, styles.textLarge]}>{title}</Text> | ||
<Text style={[styles.textSupporting, styles.textLineHeightXLarge]}>{subtitle}</Text> | ||
</View> | ||
{isError && shouldShowRedDotIndicator && ( | ||
<Icon | ||
src={Expensicons.DotIndicator} | ||
fill={theme.danger} | ||
/> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
BillingBanner.displayName = 'BillingBanner'; | ||
|
||
export default BillingBanner; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,6 +455,10 @@ const styles = (theme: ThemeColors) => | |
fontWeight: FontUtils.fontWeight.bold, | ||
}, | ||
|
||
textLineHeightXLarge: { | ||
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. This feels like a very misleading name for this... I wouldn't consider this line height to be XLarge, I would consider it to be our default line height for our default font size. 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. Does it mean updating 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. Can you confirm that our base font style includes line height? And if so, what is the line height? Because maybe we don't actually need to do anything here and we can just use our "default" text styles. |
||
lineHeight: variables.lineHeightXLarge, | ||
}, | ||
|
||
fontWeightNormal: { | ||
fontWeight: FontUtils.fontWeight.normal, | ||
}, | ||
|
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.
Does it make sense to make this optional? Are we guaranteed to have subtitle all the time?
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.
Good question, I think they both should be optional (for example: we do not have titles for API errors)
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.
updated