-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54771 from jayeshmangwani/plan_changes_to_subscri…
…ptions Plan changes to subscriptions
- Loading branch information
Showing
17 changed files
with
339 additions
and
155 deletions.
There are no files selected for viewing
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
78 changes: 78 additions & 0 deletions
78
src/pages/settings/Subscription/SubscriptionPlan/SubscriptionPlanCard.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,78 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import type {SvgProps} from 'react-native-svg'; | ||
import type {ValueOf} from 'type-fest'; | ||
import Icon from '@components/Icon'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import {PressableWithFeedback} from '@components/Pressable'; | ||
import SelectCircle from '@components/SelectCircle'; | ||
import Text from '@components/Text'; | ||
import useTheme from '@hooks/useTheme'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import type CONST from '@src/CONST'; | ||
|
||
type PersonalPolicyTypeExludedProps = Exclude<ValueOf<typeof CONST.POLICY.TYPE>, 'personal'>; | ||
|
||
type SubscriptionPlanCardProps = { | ||
index: number; | ||
plan: { | ||
title: string; | ||
src: React.FC<SvgProps>; | ||
benefits: string[]; | ||
description: string; | ||
isSelected: boolean; | ||
type: PersonalPolicyTypeExludedProps; | ||
}; | ||
|
||
onPress: (type: PersonalPolicyTypeExludedProps) => void; | ||
}; | ||
function SubscriptionPlanCard({plan, index, onPress}: SubscriptionPlanCardProps) { | ||
const styles = useThemeStyles(); | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<View style={[styles.borderedContentCard, styles.flex1, styles.mt5, styles.p5, index === 0 && styles.mr3, plan.isSelected && styles.borderColorFocus]}> | ||
<PressableWithFeedback | ||
accessibilityLabel={plan.title} | ||
wrapperStyle={[styles.flex1]} | ||
onPress={() => onPress(plan.type)} | ||
> | ||
<View style={[styles.flexRow, styles.justifyContentBetween]}> | ||
<Icon | ||
src={plan.src} | ||
width={variables.iconHeader} | ||
height={variables.iconHeader} | ||
/> | ||
<View> | ||
<SelectCircle | ||
isChecked={plan.isSelected} | ||
selectCircleStyles={styles.sectionSelectCircle} | ||
/> | ||
</View> | ||
</View> | ||
<Text style={[styles.headerText, styles.mv2]}>{plan.title}</Text> | ||
<Text style={[styles.textLabelSupporting, styles.mb2]}>{plan.description}</Text> | ||
{plan.benefits.map((benefit) => ( | ||
<View | ||
style={[styles.flexRow, styles.alignItemsCenter, styles.mt2]} | ||
key={benefit} | ||
> | ||
<Icon | ||
src={Expensicons.Checkmark} | ||
fill={theme.iconSuccessFill} | ||
width={variables.iconSizeSmall} | ||
height={variables.iconSizeSmall} | ||
/> | ||
<Text style={[styles.textMicroSupporting, styles.ml2]}>{benefit}</Text> | ||
</View> | ||
))} | ||
</PressableWithFeedback> | ||
</View> | ||
); | ||
} | ||
|
||
SubscriptionPlanCard.displayName = 'SubscriptionPlanCard'; | ||
|
||
export default SubscriptionPlanCard; | ||
export type {PersonalPolicyTypeExludedProps}; |
Oops, something went wrong.