-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 #42413 from tienifr/feature/empty-ui-for-create-flows
feat: empty ui for create flows
- Loading branch information
Showing
9 changed files
with
809 additions
and
12 deletions.
There are no files selected for viewing
667 changes: 667 additions & 0 deletions
667
assets/images/product-illustrations/todd-with-phones.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import type {TupleToUnion} from 'type-fest'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import CONST from '@src/CONST'; | ||
import BlockingView from './BlockingViews/BlockingView'; | ||
import * as Illustrations from './Icon/Illustrations'; | ||
import Text from './Text'; | ||
import TextLink from './TextLink'; | ||
|
||
type EmptySelectionListContentProps = { | ||
/** Type of selection list */ | ||
contentType: string; | ||
}; | ||
|
||
const CONTENT_TYPES = [CONST.IOU.TYPE.SUBMIT, CONST.IOU.TYPE.SPLIT, CONST.IOU.TYPE.PAY]; | ||
type ContentType = TupleToUnion<typeof CONTENT_TYPES>; | ||
|
||
function isContentType(contentType: unknown): contentType is ContentType { | ||
return CONTENT_TYPES.includes(contentType as ContentType); | ||
} | ||
|
||
function EmptySelectionListContent({contentType}: EmptySelectionListContentProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
if (!isContentType(contentType)) { | ||
return null; | ||
} | ||
|
||
const EmptySubtitle = ( | ||
<Text style={[styles.textAlignCenter]}> | ||
{translate(`emptyList.${contentType}.subtitleText1`)} | ||
<TextLink href={CONST.REFERRAL_PROGRAM.LEARN_MORE_LINK}>{translate(`emptyList.${contentType}.subtitleText2`)}</TextLink> | ||
{translate(`emptyList.${contentType}.subtitleText3`)} | ||
</Text> | ||
); | ||
|
||
return ( | ||
<View style={[styles.flex1, styles.overflowHidden]}> | ||
<BlockingView | ||
icon={Illustrations.ToddWithPhones} | ||
iconWidth={variables.emptySelectionListIconWidth} | ||
iconHeight={variables.emptySelectionListIconHeight} | ||
title={translate(`emptyList.${contentType}.title`)} | ||
shouldShowLink={false} | ||
CustomSubtitle={EmptySubtitle} | ||
containerStyle={[styles.mb8, styles.ph15]} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
EmptySelectionListContent.displayName = 'EmptySelectionListContent'; | ||
|
||
export default EmptySelectionListContent; |
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
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
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
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
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
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
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