Skip to content
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

Feat: Update font #43733

Merged
merged 17 commits into from
Jun 21, 2024
2 changes: 1 addition & 1 deletion src/components/SelectionList/Search/ReportListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function TotalCell({showTooltip, isLargeScreenWidth, reportItem}: ReportCellProp
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString((reportItem?.type === CONST.REPORT.TYPE.EXPENSE ? -1 : 1) * (reportItem?.total ?? 0), reportItem?.currency)}
style={[styles.optionDisplayName, styles.textNewKansasNormal, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight]}
style={[styles.optionDisplayName, styles.fontSizeNormal, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight]}
/>
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/SelectionList/Search/TextWithIconCell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import type {StyleProp, TextStyle} from 'react-native';
import Icon from '@components/Icon';
import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
Expand All @@ -11,9 +12,10 @@ type TextWithIconCellProps = {
icon: IconAsset;
text?: string;
showTooltip: boolean;
textStyle?: StyleProp<TextStyle>;
};

export default function TextWithIconCell({icon, text, showTooltip}: TextWithIconCellProps) {
export default function TextWithIconCell({icon, text, showTooltip, textStyle}: TextWithIconCellProps) {
const styles = useThemeStyles();
const theme = useTheme();

Expand All @@ -35,7 +37,7 @@ export default function TextWithIconCell({icon, text, showTooltip}: TextWithIcon
/>
<Text
numberOfLines={1}
style={[styles.optionDisplayName, styles.label, styles.pre, styles.justifyContentCenter, styles.textMicro, styles.textSupporting, styles.flexShrink1]}
style={[styles.optionDisplayName, styles.label, styles.pre, styles.justifyContentCenter, styles.textMicro, styles.textSupporting, styles.flexShrink1, textStyle]}
>
{text}
</Text>
Expand Down
22 changes: 14 additions & 8 deletions src/components/SelectionList/Search/TransactionListItemRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,19 @@ function DateCell({transactionItem, showTooltip, isLargeScreenWidth}: Transactio
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={date}
style={[styles.label, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : [styles.textMicro, styles.textSupporting]]}
style={[styles.lineHeightLarge, styles.pre, styles.justifyContentCenter, isLargeScreenWidth ? undefined : [styles.textMicro, styles.textSupporting]]}
/>
);
}

function MerchantCell({transactionItem, showTooltip}: TransactionCellProps) {
function MerchantCell({transactionItem, showTooltip, isLargeScreenWidth}: TransactionCellProps) {
const styles = useThemeStyles();
const description = TransactionUtils.getDescription(transactionItem);

return (
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={transactionItem.shouldShowMerchant ? transactionItem.formattedMerchant : description}
style={[styles.label, styles.pre, styles.justifyContentCenter]}
style={[isLargeScreenWidth && styles.lineHeightLarge, styles.pre, styles.justifyContentCenter]}
/>
);
}
Expand All @@ -119,7 +118,12 @@ function TotalCell({showTooltip, isLargeScreenWidth, transactionItem, isChildLis
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString(transactionItem.formattedTotal, currency)}
style={[styles.optionDisplayName, styles.justifyContentCenter, isLargeScreenWidth ? undefined : styles.textAlignRight, isChildListItem ? styles.label : undefined]}
style={[
styles.optionDisplayName,
styles.justifyContentCenter,
isLargeScreenWidth ? undefined : styles.textAlignRight,
isLargeScreenWidth && isChildListItem ? styles.label : undefined,
]}
/>
);
}
Expand Down Expand Up @@ -159,13 +163,14 @@ function CategoryCell({isLargeScreenWidth, showTooltip, transactionItem}: Transa
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={transactionItem?.category}
style={[styles.optionDisplayName, styles.label, styles.pre, styles.justifyContentCenter]}
style={[styles.optionDisplayName, styles.lineHeightLarge, styles.pre, styles.justifyContentCenter]}
/>
) : (
<TextWithIconCell
icon={Expensicons.Folder}
showTooltip={showTooltip}
text={transactionItem?.category}
textStyle={[styles.textMicro]}
/>
);
}
Expand All @@ -176,13 +181,14 @@ function TagCell({isLargeScreenWidth, showTooltip, transactionItem}: Transaction
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={TransactionUtils.getTagForDisplay(transactionItem)}
style={[styles.optionDisplayName, styles.label, styles.pre, styles.justifyContentCenter]}
style={[styles.optionDisplayName, styles.lineHeightLarge, styles.pre, styles.justifyContentCenter]}
/>
) : (
<TextWithIconCell
icon={Expensicons.Tag}
showTooltip={showTooltip}
text={TransactionUtils.getTagForDisplay(transactionItem)}
textStyle={[styles.textMicro]}
/>
);
}
Expand All @@ -198,7 +204,7 @@ function TaxCell({transactionItem, showTooltip}: TransactionCellProps) {
<TextWithTooltip
shouldShowTooltip={showTooltip}
text={CurrencyUtils.convertToDisplayString(taxAmount, currency)}
style={[styles.optionDisplayName, styles.label, styles.pre, styles.justifyContentCenter, styles.textAlignRight]}
style={[styles.optionDisplayName, styles.lineHeightLarge, styles.pre, styles.justifyContentCenter, styles.textAlignRight]}
/>
);
}
Expand Down
8 changes: 5 additions & 3 deletions src/components/SelectionList/Search/UserInfoCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {View} from 'react-native';
import Avatar from '@components/Avatar';
import Text from '@components/Text';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import CONST from '@src/CONST';
import type {SearchAccountDetails} from '@src/types/onyx/SearchResults';

Expand All @@ -13,24 +14,25 @@ type UserInfoCellProps = {

function UserInfoCell({participant, displayName}: UserInfoCellProps) {
const styles = useThemeStyles();

const {isLargeScreenWidth} = useWindowDimensions();
const avatarURL = participant?.avatarURL ?? participant?.avatar;
const isWorkspace = participant?.avatarURL !== undefined;
const iconType = isWorkspace ? CONST.ICON_TYPE_WORKSPACE : CONST.ICON_TYPE_AVATAR;

return (
<View style={[styles.flexRow, styles.gap1, styles.alignItemsCenter]}>
<View style={[styles.flexRow, styles.alignItemsCenter]}>
<Avatar
imageStyles={[styles.alignSelfCenter]}
size={CONST.AVATAR_SIZE.MID_SUBSCRIPT}
source={avatarURL}
name={displayName}
type={iconType}
avatarID={isWorkspace ? participant?.id : participant?.accountID}
containerStyles={[styles.pr2]}
/>
<Text
numberOfLines={1}
style={[styles.textMicroBold, styles.flexShrink1]}
style={[isLargeScreenWidth ? styles.textBold : styles.textMicro, styles.flexShrink1]}
>
{displayName}
</Text>
Expand Down
13 changes: 9 additions & 4 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ const styles = (theme: ThemeColors) =>
verticalAlignTop: {
verticalAlign: 'top',
},

lineHeightLarge: {
lineHeight: variables.lineHeightLarge,
},
label: {
fontSize: variables.fontSizeLabel,
lineHeight: variables.lineHeightLarge,
Expand Down Expand Up @@ -405,7 +407,11 @@ const styles = (theme: ThemeColors) =>
fontSize: variables.fontSizeSmall,
lineHeight: variables.lineHeightSmall,
},

textBold: {
truph01 marked this conversation as resolved.
Show resolved Hide resolved
color: theme.text,
fontWeight: FontUtils.fontWeight.bold,
lineHeight: variables.lineHeightSmall,
},
textMicroSupporting: {
color: theme.textSupporting,
fontFamily: FontUtils.fontFamily.platform.EXP_NEUE,
Expand Down Expand Up @@ -446,8 +452,7 @@ const styles = (theme: ThemeColors) =>
lineHeight: variables.lineHeightHero,
},

textNewKansasNormal: {
fontFamily: FontUtils.fontFamily.platform.EXP_NEW_KANSAS_MEDIUM,
fontSizeNormal: {
truph01 marked this conversation as resolved.
Show resolved Hide resolved
fontSize: variables.fontSizeNormal,
},

Expand Down
Loading