-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34219 from dukenv0307/fix/25193
Migrate Error page to Typescript
- Loading branch information
Showing
5 changed files
with
21 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 8 additions & 10 deletions
18
src/pages/ErrorPage/ErrorBodyText/index.js → src/pages/ErrorPage/ErrorBodyText/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import React from 'react'; | ||
import Text from '@components/Text'; | ||
import TextLink from '@components/TextLink'; | ||
import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
}; | ||
|
||
function ErrorBodyText(props) { | ||
function ErrorBodyText() { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<Text> | ||
{`${props.translate('genericErrorPage.body.helpTextMobile')} `} | ||
{`${translate('genericErrorPage.body.helpTextMobile')} `} | ||
<TextLink | ||
href={CONST.NEW_EXPENSIFY_URL} | ||
style={[styles.link]} | ||
> | ||
{props.translate('genericErrorPage.body.helpTextWeb')} | ||
{translate('genericErrorPage.body.helpTextWeb')} | ||
</TextLink> | ||
</Text> | ||
); | ||
} | ||
|
||
ErrorBodyText.displayName = 'ErrorBodyText'; | ||
ErrorBodyText.propTypes = propTypes; | ||
export default withLocalize(ErrorBodyText); | ||
|
||
export default ErrorBodyText; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 4 additions & 12 deletions
16
src/pages/ErrorPage/NotFoundPage.js → src/pages/ErrorPage/NotFoundPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
|
||
const propTypes = { | ||
/** Method to trigger when pressing back button of the header */ | ||
onBackButtonPress: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
onBackButtonPress: undefined, | ||
type NotFoundPageProps = { | ||
onBackButtonPress?: () => void; | ||
}; | ||
|
||
// eslint-disable-next-line rulesdir/no-negated-variables | ||
function NotFoundPage(props) { | ||
function NotFoundPage({onBackButtonPress}: NotFoundPageProps) { | ||
return ( | ||
<ScreenWrapper testID={NotFoundPage.displayName}> | ||
<FullPageNotFoundView | ||
shouldShow | ||
onBackButtonPress={props.onBackButtonPress} | ||
onBackButtonPress={onBackButtonPress} | ||
/> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
NotFoundPage.displayName = 'NotFoundPage'; | ||
NotFoundPage.propTypes = propTypes; | ||
NotFoundPage.defaultProps = defaultProps; | ||
|
||
export default NotFoundPage; |