-
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 #45690 from koko57/feat/44306-empty-state-modal
[No QA] Empty state modal
- Loading branch information
Showing
14 changed files
with
1,089 additions
and
24 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import React from 'react'; | ||
import {Circle, Rect} from 'react-native-svg'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
import variables from '@styles/variables'; | ||
import ItemListSkeletonView from './ItemListSkeletonView'; | ||
|
||
type CardRowSkeletonProps = { | ||
shouldAnimate?: boolean; | ||
fixedNumItems?: number; | ||
gradientOpacityEnabled?: boolean; | ||
}; | ||
|
||
const barHeight = 7; | ||
const longBarWidth = 120; | ||
const shortBarWidth = 60; | ||
const leftPaneWidth = variables.sideBarWidth; | ||
const gapWidth = 12; | ||
const rightSideElementWidth = 50; | ||
const centralPanePadding = 50; | ||
const rightButtonWidth = 20; | ||
|
||
function CardRowSkeleton({shouldAnimate = true, fixedNumItems, gradientOpacityEnabled = false}: CardRowSkeletonProps) { | ||
const styles = useThemeStyles(); | ||
const {windowWidth, isSmallScreenWidth} = useWindowDimensions(); | ||
|
||
return ( | ||
<ItemListSkeletonView | ||
shouldAnimate={shouldAnimate} | ||
fixedNumItems={fixedNumItems} | ||
gradientOpacityEnabled={gradientOpacityEnabled} | ||
itemViewStyle={[styles.highlightBG, styles.mb3, styles.br3, styles.mr3, styles.ml3]} | ||
renderSkeletonItem={() => ( | ||
<> | ||
<Circle | ||
cx={36} | ||
cy={32} | ||
r={20} | ||
/> | ||
<Rect | ||
x={66} | ||
y={22} | ||
width={longBarWidth} | ||
height={barHeight} | ||
/> | ||
|
||
<Rect | ||
x={66} | ||
y={36} | ||
width={shortBarWidth} | ||
height={barHeight} | ||
/> | ||
|
||
{!isSmallScreenWidth && ( | ||
<> | ||
<Rect | ||
// We have to calculate this value to make sure the element is aligned to the button on the right side. | ||
x={windowWidth - leftPaneWidth - rightButtonWidth - gapWidth - centralPanePadding - gapWidth - rightSideElementWidth} | ||
y={28} | ||
width={20} | ||
height={barHeight} | ||
/> | ||
|
||
<Rect | ||
// We have to calculate this value to make sure the element is aligned to the right border. | ||
x={windowWidth - leftPaneWidth - rightSideElementWidth - gapWidth - centralPanePadding} | ||
y={28} | ||
width={50} | ||
height={barHeight} | ||
/> | ||
</> | ||
)} | ||
</> | ||
)} | ||
/> | ||
); | ||
} | ||
|
||
CardRowSkeleton.displayName = 'CardRowSkeleton'; | ||
|
||
export default CardRowSkeleton; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import EmptyStateComponent from '@components/EmptyStateComponent'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import ScrollView from '@components/ScrollView'; | ||
import CardRowSkeleton from '@components/Skeletons/CardRowSkeleton'; | ||
import Text from '@components/Text'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
import CONST from '@src/CONST'; | ||
|
||
const HEADER_HEIGHT = 80; | ||
const BUTTON_HEIGHT = 40; | ||
const BUTTON_MARGIN = 12; | ||
|
||
function EmptyCardView() { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const {windowHeight, isSmallScreenWidth} = useWindowDimensions(); | ||
|
||
const headerHeight = isSmallScreenWidth ? HEADER_HEIGHT + BUTTON_HEIGHT + BUTTON_MARGIN : HEADER_HEIGHT; | ||
|
||
return ( | ||
<ScrollView> | ||
<View style={{height: windowHeight - headerHeight}}> | ||
<EmptyStateComponent | ||
SkeletonComponent={CardRowSkeleton} | ||
headerMediaType={CONST.EMPTY_STATE_MEDIA.ILLUSTRATION} | ||
headerMedia={Illustrations.EmptyCardState} | ||
headerStyles={[{overflow: 'hidden'}, isSmallScreenWidth && {maxHeight: 300}]} | ||
title={translate('workspace.expensifyCard.issueAndManageCards')} | ||
subtitle={translate('workspace.expensifyCard.getStartedIssuing')} | ||
emptyStateContentStyles={isSmallScreenWidth ? {top: -BUTTON_HEIGHT} : undefined} | ||
/> | ||
</View> | ||
<Text style={[styles.textMicroSupporting, styles.m5]}>{translate('workspace.expensifyCard.disclaimer')}</Text> | ||
</ScrollView> | ||
); | ||
} | ||
|
||
EmptyCardView.displayName = 'EmptyCardView'; | ||
|
||
export default EmptyCardView; |
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