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

[Payment card / Subscription] Polish "Subscription details" section with useThemeIllustrations #43370

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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;
Loading