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

[TS migration] Migrate Signin to TypeScript #35294

Merged
merged 75 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f8da976
[Refactor] Convert Socials.js to TypeScript
fedirjh Jan 26, 2024
8cde601
[Refactor] Convert Terms.js to TypeScript
fedirjh Jan 26, 2024
eaeebb9
[Refactor] Convert Licenses.js to TypeScript
fedirjh Jan 26, 2024
20ba59f
[Refactor] Convert SignInPageHero.js to TypeScript
fedirjh Jan 26, 2024
7a5c68a
[Refactor] Convert SignInModal.js to TypeScript
fedirjh Jan 26, 2024
10c37a0
[Refactor] Convert DesktopRedirectPage.js to TypeScript
fedirjh Jan 26, 2024
c39f6ae
[Refactor] Convert DesktopSignInRedirectPage to TypeScript
fedirjh Jan 26, 2024
9cea571
[Refactor] Convert SAMLSignInPage to TypeScript
fedirjh Jan 26, 2024
76212e5
Adjust semicolon usage and import organization
fedirjh Jan 26, 2024
41721fd
[Refactor] Convert SignIn page styles to TypeScript.
fedirjh Jan 28, 2024
93ed872
[Refactor] Convert ChangeExpensifyLoginLink to TypeScript.
fedirjh Jan 28, 2024
ffe42c9
[Refactor] Convert ChangeExpensifyLoginLink to TypeScript.
fedirjh Jan 28, 2024
f538d2c
[Refactor] Convert SignInHeroImage to TypeScript.
fedirjh Jan 28, 2024
75f96a9
[Refactor] Convert SignInHeroCopy to TypeScript.
fedirjh Jan 28, 2024
684e329
[Refactor] Convert EmailDeliveryFailurePage to TypeScript.
fedirjh Jan 28, 2024
eaf21dd
[Refactor] Convert UnlinkLoginForm to TypeScript.
fedirjh Jan 28, 2024
dd2ae56
[Chore] Add comments
fedirjh Jan 28, 2024
f922225
[Refactor] Convert ChooseSSOOrMagicCode to TypeScript.
fedirjh Jan 28, 2024
c483550
[Refactor] Convert ThirdPartySignInPage to TypeScript.
fedirjh Jan 28, 2024
4d1b5bf
[Refactor] Convert BackgroundImage to TypeScript.
fedirjh Jan 28, 2024
d284a85
[Chore] The TextLink component props definition was simplified by rem…
fedirjh Jan 28, 2024
bbf409c
[Refactor] convert to TypeScript
fedirjh Jan 28, 2024
a1168ee
[Refactor] convert ValidateCodeForm to TypeScript
fedirjh Jan 29, 2024
ee57088
[Refactor] convert LoginForm to TypeScript
fedirjh Jan 29, 2024
46247f5
[Refactor] convert SignInPageContent to TypeScript
fedirjh Jan 29, 2024
fdc97b3
[Refactor] convert SignInPageLayout to TypeScript
fedirjh Jan 29, 2024
a40388f
[Refactor] convert SignInPageLayout to TypeScript
fedirjh Jan 29, 2024
3d736a4
Revert "[Refactor] Convert ChangeExpensifyLoginLink to TypeScript."
fedirjh Feb 4, 2024
167a9e4
Revert "[Refactor] Convert ChangeExpensifyLoginLink to TypeScript."
fedirjh Feb 4, 2024
2537f6b
Revert "[Refactor] convert ValidateCodeForm to TypeScript"
fedirjh Feb 4, 2024
be857c4
Revert "[Refactor] Convert DesktopRedirectPage.js to TypeScript"
fedirjh Feb 4, 2024
c1570fd
Revert "[Refactor] Convert DesktopSignInRedirectPage to TypeScript"
fedirjh Feb 4, 2024
dd4cf14
Revert "[Refactor] convert to TypeScript"
fedirjh Feb 4, 2024
68d3efb
[Chore] Fix types
fedirjh Feb 4, 2024
9c28e14
[Chore] Fix typeScript checks + Rename BaseLoginForm
fedirjh Feb 4, 2024
18258bb
[Refactor] Migrate SignInPage to typeScript
fedirjh Feb 4, 2024
c715670
[Chore] Fix code style
fedirjh Feb 4, 2024
5971307
[Chore] Fix TS errors
fedirjh Feb 4, 2024
f01dd1c
[Chore] Fix Lint & TS
fedirjh Feb 5, 2024
28d79f3
[Chore] Fix Types
fedirjh Feb 8, 2024
f666615
[Chore] Fix nullish coalescing
fedirjh Feb 9, 2024
04218f2
[Chore] Rename File
fedirjh Feb 9, 2024
9c51d5e
[Chore] Rename TS File
fedirjh Feb 9, 2024
188fb50
[Refactor] Convert SignInPageHero.js to TypeScript
fedirjh Jan 26, 2024
ab306f4
[Refactor] Convert DesktopRedirectPage.js to TypeScript
fedirjh Jan 26, 2024
3376742
[Refactor] Convert DesktopSignInRedirectPage to TypeScript
fedirjh Jan 26, 2024
46478df
Adjust semicolon usage and import organization
fedirjh Jan 26, 2024
b305ae2
[Refactor] Convert ChangeExpensifyLoginLink to TypeScript.
fedirjh Jan 28, 2024
e58cffd
[Refactor] Convert ChangeExpensifyLoginLink to TypeScript.
fedirjh Jan 28, 2024
7f6b3bc
[Chore] The TextLink component props definition was simplified by rem…
fedirjh Jan 28, 2024
7137455
[Refactor] convert to TypeScript
fedirjh Jan 28, 2024
fcbe681
[Refactor] convert ValidateCodeForm to TypeScript
fedirjh Jan 29, 2024
14b157a
Revert "[Refactor] Convert ChangeExpensifyLoginLink to TypeScript."
fedirjh Feb 4, 2024
a8f4b16
Revert "[Refactor] Convert ChangeExpensifyLoginLink to TypeScript."
fedirjh Feb 4, 2024
43af805
Revert "[Refactor] convert ValidateCodeForm to TypeScript"
fedirjh Feb 4, 2024
a76c3c6
Revert "[Refactor] Convert DesktopRedirectPage.js to TypeScript"
fedirjh Feb 4, 2024
a133fcc
Revert "[Refactor] Convert DesktopSignInRedirectPage to TypeScript"
fedirjh Feb 4, 2024
8a70498
Revert "[Refactor] convert to TypeScript"
fedirjh Feb 4, 2024
59f5d3f
[Chore] Fix code style
fedirjh Feb 4, 2024
96be73c
[Chore] Fix Types
fedirjh Feb 8, 2024
3c6871f
[Chore] Fix nullish coalescing
fedirjh Feb 9, 2024
2a228bb
[Chore] Rename File
fedirjh Feb 9, 2024
a0d6ad3
[Chore] Rename TS File
fedirjh Feb 9, 2024
8c7ee8e
[Chore] Fix TS
fedirjh Feb 9, 2024
6c02db1
Apply suggestions from code review
fedirjh Feb 10, 2024
a3d6104
[Chore] Fix TS types: use TextLink types
fedirjh Feb 10, 2024
a95b2b3
[Chore] Fix SAMLSignIn Props
fedirjh Feb 10, 2024
dfac1a4
[Chore] Fix Lint & Address code review
fedirjh Feb 10, 2024
8550b07
[Refactor] SignInPageLayout to use shared types
fedirjh Feb 10, 2024
d051374
[Chore] Fix TS Types & address code review
fedirjh Feb 11, 2024
8ba10de
[Chore] Fix TS Types & address code review
fedirjh Feb 12, 2024
a97b3cc
Merge branch 'main' into ts-migration-signin
fedirjh Feb 13, 2024
c2a718c
[Chore] Fix merge conflicts
fedirjh Feb 14, 2024
b7f9979
[Chore] Remove extra file
fedirjh Feb 14, 2024
f914990
[Chore] Remove outdated TS directives
fedirjh Feb 14, 2024
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
2 changes: 2 additions & 0 deletions src/components/TextLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ function TextLink({href, onPress, children, style, onMouseDown = (event) => even

TextLink.displayName = 'TextLink';

export type {LinkProps, PressProps};

export default forwardRef(TextLink);
3 changes: 1 addition & 2 deletions src/pages/signin/LoginForm/BaseLoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
autoCapitalize="none"
autoCorrect={false}
inputMode={CONST.INPUT_MODE.EMAIL}
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
errorText={formError || ''}
errorText={formError}
hasError={shouldShowServerError}
maxLength={CONST.LOGIN_CHARACTER_LIMIT}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/signin/LoginForm/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function LoginForm({scrollPageToTop, ...rest}: LoginFormProps, ref: ForwardedRef
const loginFormRef = useRef<InputHandle>();

useImperativeHandle(ref, () => ({
isInputFocused: () => !!loginFormRef.current?.isInputFocused(),
clearDataAndFocus: (clearLogin = true) => loginFormRef.current?.clearDataAndFocus(clearLogin),
isInputFocused: loginFormRef.current ? loginFormRef.current.isInputFocused : () => false,
clearDataAndFocus: loginFormRef.current ? loginFormRef.current?.clearDataAndFocus : () => null,
}));

useEffect(() => {
Expand Down
27 changes: 7 additions & 20 deletions src/pages/signin/SAMLSignInPage/index.native.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useCallback, useState} from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import WebView from 'react-native-webview';
import type {WebViewNativeEvent} from 'react-native-webview/lib/WebViewTypes';
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView';
Expand All @@ -14,19 +13,9 @@ import * as Session from '@userActions/Session';
import CONFIG from '@src/CONFIG';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Account, Credentials} from '@src/types/onyx';
import type {SAMLSignInPageNativeOnyxProps, SAMLSignInPageProps} from './types';

type SAMLSignInPageOnyxProps = {
/** The credentials of the logged in person */
credentials: OnyxEntry<Credentials>;

/** State of the logging in user's account */
account: OnyxEntry<Account>;
};

type SAMLSignInPageProps = SAMLSignInPageOnyxProps;

function SAMLSignInPage({credentials, account}: SAMLSignInPageProps) {
function SAMLSignInPage({credentials, account}: SAMLSignInPageProps<SAMLSignInPageNativeOnyxProps>) {
const samlLoginURL = `${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials?.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}&platform=${getPlatform()}`;
const [showNavigation, shouldShowNavigation] = useState(true);

Expand All @@ -42,18 +31,16 @@ function SAMLSignInPage({credentials, account}: SAMLSignInPageProps) {
}

const searchParams = new URLSearchParams(new URL(url).search);
if (searchParams.has('shortLivedAuthToken') && !account?.isLoading) {
const shortLivedAuthToken = searchParams.get('shortLivedAuthToken');
if (!account?.isLoading && credentials?.login && !!shortLivedAuthToken) {
Log.info('SAMLSignInPage - Successfully received shortLivedAuthToken. Signing in...');
const shortLivedAuthToken = searchParams.get('shortLivedAuthToken');
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Session.signInWithShortLivedAuthToken(credentials?.login || '', shortLivedAuthToken || '');
Session.signInWithShortLivedAuthToken(credentials.login, shortLivedAuthToken);
}

// If the login attempt is unsuccessful, set the error message for the account and redirect to sign in page
if (searchParams.has('error')) {
Session.clearSignInData();
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Session.setAccountError(searchParams.get('error') || '');
Session.setAccountError(searchParams.get('error') ?? '');
Navigation.navigate(ROUTES.HOME);
}
},
Expand Down Expand Up @@ -91,7 +78,7 @@ function SAMLSignInPage({credentials, account}: SAMLSignInPageProps) {

SAMLSignInPage.displayName = 'SAMLSignInPage';

export default withOnyx<SAMLSignInPageProps, SAMLSignInPageOnyxProps>({
export default withOnyx<SAMLSignInPageProps<SAMLSignInPageNativeOnyxProps>, SAMLSignInPageNativeOnyxProps>({
credentials: {key: ONYXKEYS.CREDENTIALS},
account: {key: ONYXKEYS.ACCOUNT},
})(SAMLSignInPage);
14 changes: 3 additions & 11 deletions src/pages/signin/SAMLSignInPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import React, {useEffect} from 'react';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import SAMLLoadingIndicator from '@components/SAMLLoadingIndicator';
import CONFIG from '@src/CONFIG';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Credentials} from '@src/types/onyx';
import type {SAMLSignInPageOnyxProps, SAMLSignInPageProps} from './types';

type SAMLSignInPageOnyxProps = {
/** The credentials of the logged in person */
credentials: OnyxEntry<Credentials>;
};

type SAMLSignInPageProps = SAMLSignInPageOnyxProps;

function SAMLSignInPage({credentials}: SAMLSignInPageProps) {
function SAMLSignInPage({credentials}: SAMLSignInPageProps<SAMLSignInPageOnyxProps>) {
useEffect(() => {
window.open(`${CONFIG.EXPENSIFY.SAML_URL}?email=${credentials?.login}&referer=${CONFIG.EXPENSIFY.EXPENSIFY_CASH_REFERER}`, '_self');
}, [credentials?.login]);
Expand All @@ -23,6 +15,6 @@ function SAMLSignInPage({credentials}: SAMLSignInPageProps) {

SAMLSignInPage.displayName = 'SAMLSignInPage';

export default withOnyx<SAMLSignInPageProps, SAMLSignInPageOnyxProps>({
export default withOnyx<SAMLSignInPageProps<SAMLSignInPageOnyxProps>, SAMLSignInPageOnyxProps>({
credentials: {key: ONYXKEYS.CREDENTIALS},
})(SAMLSignInPage);
16 changes: 16 additions & 0 deletions src/pages/signin/SAMLSignInPage/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type {OnyxEntry} from 'react-native-onyx';
import type {Account, Credentials} from '@src/types/onyx';

type SAMLSignInPageOnyxProps = {
/** The credentials of the logged in person */
credentials: OnyxEntry<Credentials>;
};

type SAMLSignInPageNativeOnyxProps = SAMLSignInPageOnyxProps & {
/** State of the logging in user's account */
account: OnyxEntry<Account>;
};
fedirjh marked this conversation as resolved.
Show resolved Hide resolved

type SAMLSignInPageProps<OnyxProps> = OnyxProps;

export type {SAMLSignInPageProps, SAMLSignInPageNativeOnyxProps, SAMLSignInPageOnyxProps};
2 changes: 1 addition & 1 deletion src/pages/signin/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import ChooseSSOOrMagicCode from './ChooseSSOOrMagicCode';
import EmailDeliveryFailurePage from './EmailDeliveryFailurePage';
import LoginForm from './LoginForm';
import type {InputHandle} from './LoginForm/types';
import type {SignInPageLayoutRef} from './SignInPageLayout';
import SignInPageLayout from './SignInPageLayout';
import type {SignInPageLayoutRef} from './SignInPageLayout/types';
import UnlinkLoginForm from './UnlinkLoginForm';
import ValidateCodeForm from './ValidateCodeForm';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type {ImageStyle} from 'expo-image';
import {Image} from 'expo-image';
import React, {useMemo} from 'react';
import type {ImageSourcePropType} from 'react-native';
Expand All @@ -16,7 +15,7 @@ function BackgroundImage({width, transitionDuration, isSmallScreen = false}: Bac
return (
<Image
source={src as ImageSourcePropType}
style={[styles.signInBackground, StyleUtils.getWidthStyle(width) as ImageStyle]}
style={[styles.signInBackground, StyleUtils.getWidthStyle(width)]}
transition={transitionDuration}
/>
);
Expand Down
74 changes: 36 additions & 38 deletions src/pages/signin/SignInPageLayout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import {View} from 'react-native';
import SignInGradient from '@assets/images/home-fade-gradient--mobile.svg';
import Hoverable from '@components/Hoverable';
import * as Expensicons from '@components/Icon/Expensicons';
import ImageSVG from '@components/ImageSVG';
import Text from '@components/Text';
import type {LinkProps, PressProps} from '@components/TextLink';
import TextLink from '@components/TextLink';
import useLocalize from '@hooks/useLocalize';
import useStyleUtils from '@hooks/useStyleUtils';
Expand All @@ -16,13 +18,11 @@ import Socials from '@pages/signin/Socials';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {SignInPageLayoutProps} from './types';

type FooterProps = {
navigateFocus: () => void;
shouldShowSmallScreen?: boolean;
};
type FooterProps = Pick<SignInPageLayoutProps, 'navigateFocus' | 'shouldShowSmallScreen'>;

type FooterColumnRow = ({onPress: () => void; link?: string} | {onPress?: () => void; link: string}) & {
type FooterColumnRow = (LinkProps | PressProps) & {
translationPath: TranslationPaths;
};

Expand All @@ -31,44 +31,44 @@ type FooterColumnData = {
rows: FooterColumnRow[];
};

const columns = ({navigateFocus}: {navigateFocus: () => void}): FooterColumnData[] => [
const columns = ({navigateFocus = () => {}}: Pick<FooterProps, 'navigateFocus'>): FooterColumnData[] => [
{
translationPath: 'footer.features',
rows: [
{
link: CONST.FOOTER.EXPENSE_MANAGEMENT_URL,
href: CONST.FOOTER.EXPENSE_MANAGEMENT_URL,
translationPath: 'footer.expenseManagement',
},
{
link: CONST.FOOTER.SPEND_MANAGEMENT_URL,
href: CONST.FOOTER.SPEND_MANAGEMENT_URL,
translationPath: 'footer.spendManagement',
},
{
link: CONST.FOOTER.EXPENSE_REPORTS_URL,
href: CONST.FOOTER.EXPENSE_REPORTS_URL,
translationPath: 'footer.expenseReports',
},
{
link: CONST.FOOTER.COMPANY_CARD_URL,
href: CONST.FOOTER.COMPANY_CARD_URL,
translationPath: 'footer.companyCreditCard',
},
{
link: CONST.FOOTER.RECIEPT_SCANNING_URL,
href: CONST.FOOTER.RECIEPT_SCANNING_URL,
translationPath: 'footer.receiptScanningApp',
},
{
link: CONST.FOOTER.BILL_PAY_URL,
href: CONST.FOOTER.BILL_PAY_URL,
translationPath: 'footer.billPay',
},
{
link: CONST.FOOTER.INVOICES_URL,
href: CONST.FOOTER.INVOICES_URL,
translationPath: 'footer.invoicing',
},
{
link: CONST.FOOTER.PAYROLL_URL,
href: CONST.FOOTER.PAYROLL_URL,
translationPath: 'footer.payroll',
},
{
link: CONST.FOOTER.TRAVEL_URL,
href: CONST.FOOTER.TRAVEL_URL,
translationPath: 'footer.travel',
},
],
Expand All @@ -77,27 +77,27 @@ const columns = ({navigateFocus}: {navigateFocus: () => void}): FooterColumnData
translationPath: 'footer.resources',
rows: [
{
link: CONST.FOOTER.EXPENSIFY_APPROVED_URL,
href: CONST.FOOTER.EXPENSIFY_APPROVED_URL,
translationPath: 'footer.expensifyApproved',
},
{
link: CONST.FOOTER.PRESS_KIT_URL,
href: CONST.FOOTER.PRESS_KIT_URL,
translationPath: 'footer.pressKit',
},
{
link: CONST.FOOTER.SUPPORT_URL,
href: CONST.FOOTER.SUPPORT_URL,
translationPath: 'footer.support',
},
{
link: CONST.NEWHELP_URL,
href: CONST.NEWHELP_URL,
translationPath: 'footer.expensifyHelp',
},
{
link: CONST.FOOTER.COMMUNITY_URL,
href: CONST.FOOTER.COMMUNITY_URL,
translationPath: 'footer.community',
},
{
link: CONST.FOOTER.PRIVACY_URL,
href: CONST.FOOTER.PRIVACY_URL,
translationPath: 'footer.privacy',
},
],
Expand All @@ -106,23 +106,23 @@ const columns = ({navigateFocus}: {navigateFocus: () => void}): FooterColumnData
translationPath: 'footer.learnMore',
rows: [
{
link: CONST.FOOTER.ABOUT_URL,
href: CONST.FOOTER.ABOUT_URL,
translationPath: 'footer.aboutExpensify',
},
{
link: CONST.FOOTER.BLOG_URL,
href: CONST.FOOTER.BLOG_URL,
translationPath: 'footer.blog',
},
{
link: CONST.FOOTER.JOBS_URL,
href: CONST.FOOTER.JOBS_URL,
translationPath: 'footer.jobs',
},
{
link: CONST.FOOTER.ORG_URL,
href: CONST.FOOTER.ORG_URL,
translationPath: 'footer.expensifyOrg',
},
{
link: CONST.FOOTER.INVESTOR_RELATIONS_URL,
href: CONST.FOOTER.INVESTOR_RELATIONS_URL,
translationPath: 'footer.investorRelations',
},
],
Expand Down Expand Up @@ -156,7 +156,7 @@ function Footer({shouldShowSmallScreen = false, navigateFocus}: FooterProps) {
const footerColumns = [styles.footerColumnsContainer, columnDirection];
const footerColumn = isVertical ? [styles.p4] : [styles.p4, isMediumScreenWidth ? styles.w50 : styles.w25];
const footerWrapper = isVertical ? [StyleUtils.getBackgroundColorStyle(theme.signInPage), styles.overflowHidden] : [];
const getTextLinkStyle = (hovered: boolean) => [styles.footerRow, hovered ? styles.textBlue : {}];
const getTextLinkStyle: (hovered: boolean) => StyleProp<TextStyle> = (hovered) => [styles.footerRow, hovered ? styles.textBlue : {}];
return (
<View style={[styles.flex1]}>
<View style={footerWrapper}>
Expand All @@ -177,26 +177,24 @@ function Footer({shouldShowSmallScreen = false, navigateFocus}: FooterProps) {
>
<Text style={[styles.textHeadline, styles.footerTitle]}>{translate(column.translationPath)}</Text>
<View style={[styles.footerRow]}>
{column.rows.map(({link, onPress, translationPath}) => (
{column.rows.map(({href, onPress, translationPath}) => (
<Hoverable key={translationPath}>
{(hovered) => (
<View>
{link ? (
{onPress ? (
<TextLink
style={getTextLinkStyle(hovered)}
href={link}
onPress={onPress}
>
{translate(translationPath)}
</TextLink>
) : (
onPress && (
<TextLink
style={getTextLinkStyle(hovered)}
onPress={onPress}
>
{translate(translationPath)}
</TextLink>
)
<TextLink
style={getTextLinkStyle(hovered)}
href={href}
>
{translate(translationPath)}
</TextLink>
)}
</View>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import variables from '@styles/variables';
import type {SignInPageLayoutProps} from './types';

type SignInHeroCopyProps = {
/** Override the green headline copy */
customHeadline?: string;
type SignInHeroCopyProps = Pick<SignInPageLayoutProps, 'customHeadline' | 'customHeroBody'>;

/** Override the smaller hero body copy below the headline */
customHeroBody?: string;
};

function SignInHeroCopy({customHeadline = '', customHeroBody = ''}: SignInHeroCopyProps) {
function SignInHeroCopy({customHeadline, customHeroBody}: SignInHeroCopyProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {isMediumScreenWidth, isLargeScreenWidth} = useWindowDimensions();
Expand All @@ -30,9 +25,13 @@ function SignInHeroCopy({customHeadline = '', customHeroBody = ''}: SignInHeroCo
isLargeScreenWidth && StyleUtils.getFontSizeStyle(variables.fontSizeSignInHeroLarge),
]}
>
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
{customHeadline || translate('login.hero.header')}
fedirjh marked this conversation as resolved.
Show resolved Hide resolved
</Text>
<Text style={[styles.loginHeroBody]}>{customHeroBody || translate('login.hero.body')}</Text>
<Text style={[styles.loginHeroBody]}>
{/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing */}
{customHeroBody || translate('login.hero.body')}
</Text>
</View>
);
}
Expand Down
Loading
Loading