Skip to content

Commit

Permalink
Merge pull request #43370 from JKobrynski/polishSubscriptionDetailsSe…
Browse files Browse the repository at this point in the history
…ction

[Payment card / Subscription] Polish "Subscription details" section with useThemeIllustrations
  • Loading branch information
roryabraham committed Jun 11, 2024
2 parents 6044241 + f30c194 commit 009b050
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import OptionItem from '@components/OptionsPicker/OptionItem';
import Section from '@components/Section';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemeIllustrations from '@hooks/useThemeIllustrations';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
Expand All @@ -16,6 +17,8 @@ import ONYXKEYS from '@src/ONYXKEYS';
function SubscriptionDetails() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const illustrations = useThemeIllustrations();

const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION);

const [account] = useOnyx(ONYXKEYS.ACCOUNT);
Expand Down Expand Up @@ -48,7 +51,7 @@ function SubscriptionDetails() {
{!!account?.isApprovedAccountant || !!account?.isApprovedAccountantClient ? (
<View style={[styles.borderedContentCard, styles.p5, styles.mt5]}>
<Icon
src={Illustrations.ExpensifyApprovedLogo}
src={illustrations.ExpensifyApprovedLogo}
width={variables.modalTopIconWidth}
height={variables.menuIconSize}
/>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/settings/Subscription/SubscriptionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import OptionsPicker from '@components/OptionsPicker';
import Section from '@components/Section';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useThemeIllustrations from '@hooks/useThemeIllustrations';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
import CONST from '@src/CONST';
Expand All @@ -33,10 +34,10 @@ const options: Array<OptionsPickerItem<SubscriptionVariant>> = [
function SubscriptionDetails() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const illustrations = useThemeIllustrations();

const [privateSubscription] = useOnyx(ONYXKEYS.NVP_PRIVATE_SUBSCRIPTION);
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
const [preferredTheme] = useOnyx(ONYXKEYS.PREFERRED_THEME);

const [selectedOption, setSelectedOption] = useState(privateSubscription?.type ?? CONST.SUBSCRIPTION.TYPE.ANNUAL);

Expand Down Expand Up @@ -81,7 +82,7 @@ function SubscriptionDetails() {
{!!account?.isApprovedAccountant || !!account?.isApprovedAccountantClient ? (
<View style={[styles.borderedContentCard, styles.p5, styles.mt5]}>
<Icon
src={preferredTheme === CONST.THEME.LIGHT ? Illustrations.ExpensifyApprovedLogoLight : Illustrations.ExpensifyApprovedLogo}
src={illustrations.ExpensifyApprovedLogo}
width={variables.modalTopIconWidth}
height={variables.menuIconSize}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/styles/theme/illustrations/themes/dark.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ExpensifyApprovedLogo from '@assets/images/subscription-details__approvedlogo.svg';
import EmptyStateBackgroundImage from '@assets/images/themeDependent/empty-state_background-fade-dark.png';
import ExampleCheckEN from '@assets/images/themeDependent/example-check-image-dark-en.png';
import ExampleCheckES from '@assets/images/themeDependent/example-check-image-dark-es.png';
Expand All @@ -9,6 +10,7 @@ const illustrations = {
ExampleCheckEN,
ExampleCheckES,
WorkspaceProfile,
ExpensifyApprovedLogo,
} satisfies IllustrationsType;

export default illustrations;
2 changes: 2 additions & 0 deletions src/styles/theme/illustrations/themes/light.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ExpensifyApprovedLogo from '@assets/images/subscription-details__approvedlogo--light.svg';
import EmptyStateBackgroundImage from '@assets/images/themeDependent/empty-state_background-fade-light.png';
import ExampleCheckEN from '@assets/images/themeDependent/example-check-image-light-en.png';
import ExampleCheckES from '@assets/images/themeDependent/example-check-image-light-es.png';
Expand All @@ -9,6 +10,7 @@ const illustrations = {
ExampleCheckEN,
ExampleCheckES,
WorkspaceProfile,
ExpensifyApprovedLogo,
} satisfies IllustrationsType;

export default illustrations;
3 changes: 3 additions & 0 deletions src/styles/theme/illustrations/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import type {FC} from 'react';
import type {ImageSourcePropType} from 'react-native';
import type {SvgProps} from 'react-native-svg';

type IllustrationsType = {
EmptyStateBackgroundImage: ImageSourcePropType;
ExampleCheckES: ImageSourcePropType;
ExampleCheckEN: ImageSourcePropType;
WorkspaceProfile: ImageSourcePropType;
ExpensifyApprovedLogo: FC<SvgProps>;
};

export default IllustrationsType;

0 comments on commit 009b050

Please sign in to comment.