Skip to content

Commit 5ce8cab

Browse files
authored
Merge pull request Expensify#82961 from Expensify/georgia-cards
Add inactive pill to cardlist, show frozen card
2 parents 0ac6e23 + 98e08ef commit 5ce8cab

14 files changed

Lines changed: 83 additions & 25 deletions

File tree

src/components/MenuItem.tsx

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ type MenuItemBaseProps = ForwardedFSClassProps &
183183
/** A description text to show under the title */
184184
description?: string;
185185

186+
/** Optional component to render before the description text (e.g. a badge pill) */
187+
descriptionAddon?: ReactNode;
188+
186189
/** Text to show below menu item. This text is not interactive */
187190
helperText?: string;
188191

@@ -507,6 +510,7 @@ function MenuItem({
507510
furtherDetailsStyle,
508511
furtherDetailsComponent,
509512
description,
513+
descriptionAddon,
510514
helperText,
511515
helperTextStyle,
512516
errorText,
@@ -645,13 +649,41 @@ function MenuItem({
645649

646650
const descriptionTextStyles = StyleUtils.combineStyles<TextStyle>([
647651
styles.textLabelSupporting,
648-
icon && !Array.isArray(icon) ? styles.ml3 : {},
649-
title ? descriptionVerticalMargin : StyleUtils.getFontSizeStyle(variables.fontSizeNormal),
652+
styles.flex1,
653+
title ? {} : StyleUtils.getFontSizeStyle(variables.fontSizeNormal),
650654
title ? styles.textLineHeightNormal : StyleUtils.getLineHeightStyle(variables.fontSizeNormalHeight),
655+
!descriptionAddon && icon && !Array.isArray(icon) ? styles.ml3 : {},
656+
descriptionAddon ? styles.ml2 : {},
651657
(descriptionTextStyle as TextStyle) || styles.breakWord,
652658
isDeleted ? styles.offlineFeedbackDeleted : {},
653659
]);
654660

661+
const descriptionContainerStyle = StyleUtils.combineStyles<ViewStyle>([
662+
styles.flexRow,
663+
styles.alignItemsCenter,
664+
descriptionAddon && icon && !Array.isArray(icon) ? styles.ml3 : {},
665+
title ? descriptionVerticalMargin : {},
666+
]);
667+
668+
const renderDescriptionView = () => {
669+
if (!description && !descriptionAddon) {
670+
return null;
671+
}
672+
return (
673+
<View style={descriptionContainerStyle}>
674+
{descriptionAddon}
675+
{!!description && (
676+
<Text
677+
style={descriptionTextStyles}
678+
numberOfLines={numberOfLinesDescription}
679+
>
680+
{description}
681+
</Text>
682+
)}
683+
</View>
684+
);
685+
};
686+
655687
const html = useMemo(() => {
656688
if (!title || !shouldParseTitle) {
657689
return '';
@@ -943,14 +975,7 @@ function MenuItem({
943975
titleContainerStyle,
944976
]}
945977
>
946-
{!!description && shouldShowDescriptionOnTop && (
947-
<Text
948-
style={descriptionTextStyles}
949-
numberOfLines={numberOfLinesDescription}
950-
>
951-
{description}
952-
</Text>
953-
)}
978+
{shouldShowDescriptionOnTop && renderDescriptionView()}
954979
{(!!title || !!shouldShowTitleIcon) && (
955980
<View
956981
style={[styles.flexRow, styles.alignItemsCenter, styles.mw100, titleWrapperStyle]}
@@ -981,14 +1006,7 @@ function MenuItem({
9811006
)}
9821007
</View>
9831008
)}
984-
{!!description && !shouldShowDescriptionOnTop && (
985-
<Text
986-
style={descriptionTextStyles}
987-
numberOfLines={numberOfLinesDescription}
988-
>
989-
{description}
990-
</Text>
991-
)}
1009+
{!shouldShowDescriptionOnTop && renderDescriptionView()}
9921010
{!!furtherDetails && (
9931011
<View style={[styles.flexRow, styles.mt1, styles.alignItemsCenter]}>
9941012
{!!furtherDetailsIcon && (

src/languages/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,6 +2305,7 @@ const translations: TranslationDeepObject<typeof en> = {
23052305
enableWallet: 'Wallet aktivieren',
23062306
addBankAccountToSendAndReceive: 'Füge ein Bankkonto hinzu, um Zahlungen zu senden oder zu empfangen.',
23072307
addDebitOrCreditCard: 'Debit- oder Kreditkarte hinzufügen',
2308+
cardInactive: 'Inaktiv',
23082309
assignedCards: 'Zugewiesene Karten',
23092310
assignedCardsDescription: 'Transaktionen von diesen Karten werden automatisch synchronisiert.',
23102311
expensifyCard: 'Expensify Karte',

src/languages/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,6 +2378,7 @@ const translations = {
23782378
enableWallet: 'Enable wallet',
23792379
addBankAccountToSendAndReceive: 'Add a bank account to make or receive payments.',
23802380
addDebitOrCreditCard: 'Add debit or credit card',
2381+
cardInactive: 'Inactive',
23812382
assignedCards: 'Assigned cards',
23822383
assignedCardsDescription: 'Transactions from these cards sync automatically.',
23832384
expensifyCard: 'Expensify Card',

src/languages/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,6 +2230,7 @@ const translations: TranslationDeepObject<typeof en> = {
22302230
enableWallet: 'Habilitar billetera',
22312231
addBankAccountToSendAndReceive: 'Añade una cuenta bancaria para hacer o recibir pagos.',
22322232
addDebitOrCreditCard: 'Añadir tarjeta de débito o crédito',
2233+
cardInactive: 'Inactiva',
22332234
assignedCards: 'Tarjetas asignadas',
22342235
assignedCardsDescription: 'Las transacciones de estas tarjetas se sincronizan automáticamente.',
22352236
expensifyCard: 'Tarjeta Expensify',

src/languages/fr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,7 @@ const translations: TranslationDeepObject<typeof en> = {
23112311
enableWallet: 'Activer le portefeuille',
23122312
addBankAccountToSendAndReceive: 'Ajoutez un compte bancaire pour effectuer ou recevoir des paiements.',
23132313
addDebitOrCreditCard: 'Ajouter une carte de débit ou de crédit',
2314+
cardInactive: 'Inactif',
23142315
assignedCards: 'Cartes assignées',
23152316
assignedCardsDescription: 'Les transactions de ces cartes se synchronisent automatiquement.',
23162317
expensifyCard: 'Carte Expensify',

src/languages/it.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2306,6 +2306,7 @@ const translations: TranslationDeepObject<typeof en> = {
23062306
enableWallet: 'Abilita portafoglio',
23072307
addBankAccountToSendAndReceive: 'Aggiungi un conto bancario per effettuare o ricevere pagamenti.',
23082308
addDebitOrCreditCard: 'Aggiungi carta di debito o di credito',
2309+
cardInactive: 'Inattivo',
23092310
assignedCards: 'Carte assegnate',
23102311
assignedCardsDescription: 'Le transazioni di queste carte si sincronizzano automaticamente.',
23112312
expensifyCard: 'Carta Expensify',

src/languages/ja.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,6 +2284,7 @@ const translations: TranslationDeepObject<typeof en> = {
22842284
enableWallet: 'ウォレットを有効にする',
22852285
addBankAccountToSendAndReceive: '支払いや入金を行うには銀行口座を追加してください。',
22862286
addDebitOrCreditCard: 'デビットカードまたはクレジットカードを追加',
2287+
cardInactive: '非アクティブ',
22872288
assignedCards: '割り当て済みカード',
22882289
assignedCardsDescription: 'これらのカードからの取引は自動的に同期されます。',
22892290
expensifyCard: 'Expensify カード',

src/languages/nl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,6 +2303,7 @@ const translations: TranslationDeepObject<typeof en> = {
23032303
enableWallet: 'Portemonnee inschakelen',
23042304
addBankAccountToSendAndReceive: 'Voeg een bankrekening toe om betalingen te doen of te ontvangen.',
23052305
addDebitOrCreditCard: 'Debet- of creditcard toevoegen',
2306+
cardInactive: 'Inactief',
23062307
assignedCards: 'Toegewezen kaarten',
23072308
assignedCardsDescription: 'Transacties van deze kaarten worden automatisch gesynchroniseerd.',
23082309
expensifyCard: 'Expensify Kaart',

src/languages/pl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,7 @@ const translations: TranslationDeepObject<typeof en> = {
23022302
enableWallet: 'Włącz portfel',
23032303
addBankAccountToSendAndReceive: 'Dodaj konto bankowe, aby wysyłać lub odbierać płatności.',
23042304
addDebitOrCreditCard: 'Dodaj kartę debetową lub kredytową',
2305+
cardInactive: 'Nieaktywne',
23052306
assignedCards: 'Przypisane karty',
23062307
assignedCardsDescription: 'Transakcje z tych kart synchronizują się automatycznie.',
23072308
expensifyCard: 'Karta Expensify',

src/languages/pt-BR.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,7 @@ const translations: TranslationDeepObject<typeof en> = {
22992299
enableWallet: 'Ativar carteira',
23002300
addBankAccountToSendAndReceive: 'Adicione uma conta bancária para fazer ou receber pagamentos.',
23012301
addDebitOrCreditCard: 'Adicionar cartão de débito ou crédito',
2302+
cardInactive: 'Inativo',
23022303
assignedCards: 'Cartões atribuídos',
23032304
assignedCardsDescription: 'As transações desses cartões são sincronizadas automaticamente.',
23042305
expensifyCard: 'Cartão Expensify',

0 commit comments

Comments
 (0)