forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Expensify#32667 from software-mansion-labs/hold-re…
…quest/educational-interstitial [W7: H Requests] Educational Interstitial
- Loading branch information
Showing
18 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
assets/images/simple-illustrations/simple-illustration__commentbubbles.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions
56
assets/images/simple-illustrations/simple-illustration__hourglass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions
52
assets/images/simple-illustrations/simple-illustration__trashcan.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
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,78 @@ | ||
import React from 'react'; | ||
import {ImageSourcePropType, View} from 'react-native'; | ||
import {SvgProps} from 'react-native-svg'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import variables from '@styles/variables'; | ||
import {TranslationPaths} from '@src/languages/types'; | ||
import Icon from './Icon'; | ||
import * as Illustrations from './Icon/Illustrations'; | ||
import Text from './Text'; | ||
|
||
type HoldMenuSection = { | ||
/** The icon supplied with the section */ | ||
icon: React.FC<SvgProps> | ImageSourcePropType; | ||
|
||
/** Translation key for the title */ | ||
titleTranslationKey: TranslationPaths; | ||
|
||
/** Translation key for the description */ | ||
descriptionTranslationKey: TranslationPaths; | ||
}; | ||
|
||
function HoldMenuSectionList() { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
const holdMenuSections: HoldMenuSection[] = [ | ||
{ | ||
icon: Illustrations.Hourglass, | ||
titleTranslationKey: 'iou.whatIsHoldTitle', | ||
descriptionTranslationKey: 'iou.whatIsHoldExplain', | ||
}, | ||
{ | ||
icon: Illustrations.CommentBubbles, | ||
titleTranslationKey: 'iou.holdIsTemporaryTitle', | ||
descriptionTranslationKey: 'iou.holdIsTemporaryExplain', | ||
}, | ||
{ | ||
icon: Illustrations.TrashCan, | ||
titleTranslationKey: 'iou.deleteHoldTitle', | ||
descriptionTranslationKey: 'iou.deleteHoldExplain', | ||
}, | ||
]; | ||
|
||
return ( | ||
<> | ||
{holdMenuSections.map((section, i) => ( | ||
<View | ||
// eslint-disable-next-line react/no-array-index-key | ||
key={i} | ||
style={[styles.flexRow, styles.alignItemsCenter, styles.mb5]} | ||
> | ||
<Icon | ||
width={variables.holdMenuIconSize} | ||
height={variables.holdMenuIconSize} | ||
src={section.icon} | ||
additionalStyles={[styles.mr3]} | ||
/> | ||
<View style={[styles.flex1, styles.justifyContentCenter]}> | ||
<Text style={[styles.textStrong, styles.mb1]}>{translate(section.titleTranslationKey)}</Text> | ||
<Text | ||
style={[styles.textNormal]} | ||
numberOfLines={3} | ||
> | ||
{translate(section.descriptionTranslationKey)} | ||
</Text> | ||
</View> | ||
</View> | ||
))} | ||
</> | ||
); | ||
} | ||
|
||
HoldMenuSectionList.displayName = 'HoldMenuSectionList'; | ||
|
||
export type {HoldMenuSection}; | ||
|
||
export default HoldMenuSectionList; |
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,66 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Button from './Button'; | ||
import HoldMenuSectionList from './HoldMenuSectionList'; | ||
import {PopoverAnchorPosition} from './Modal/types'; | ||
import Popover from './Popover'; | ||
import {AnchorAlignment} from './Popover/types'; | ||
import Text from './Text'; | ||
import TextPill from './TextPill'; | ||
|
||
type ProcessMoneyRequestHoldMenuProps = { | ||
/** Whether the content is visible */ | ||
isVisible: boolean; | ||
|
||
/** Method to trigger when pressing outside of the popover menu to close it */ | ||
onClose: () => void; | ||
|
||
/** Method to trigger when pressing confirm button */ | ||
onConfirm: () => void; | ||
|
||
/** The anchor position of the popover menu */ | ||
anchorPosition?: PopoverAnchorPosition; | ||
|
||
/** The anchor alignment of the popover menu */ | ||
anchorAlignment: AnchorAlignment; | ||
|
||
/** The anchor ref of the popover menu */ | ||
anchorRef: React.RefObject<HTMLElement>; | ||
}; | ||
|
||
function ProcessMoneyRequestHoldMenu({isVisible, onClose, onConfirm, anchorPosition, anchorAlignment, anchorRef}: ProcessMoneyRequestHoldMenuProps) { | ||
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
|
||
return ( | ||
<Popover | ||
isVisible={isVisible} | ||
onClose={onClose} | ||
anchorPosition={anchorPosition} | ||
anchorRef={anchorRef} | ||
anchorAlignment={anchorAlignment} | ||
disableAnimation={false} | ||
withoutOverlay={false} | ||
> | ||
<View style={[styles.mh5, styles.mv5]}> | ||
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb5]}> | ||
<Text style={[styles.textHeadline, styles.mr2]}>{translate('iou.holdEducationalTitle')}</Text> | ||
<TextPill textStyles={styles.holdRequestInline}>{translate('iou.hold')}</TextPill>; | ||
</View> | ||
<HoldMenuSectionList /> | ||
<Button | ||
success | ||
style={[styles.mt5]} | ||
text={translate('common.buttonConfirm')} | ||
onPress={onConfirm} | ||
/> | ||
</View> | ||
</Popover> | ||
); | ||
} | ||
|
||
ProcessMoneyRequestHoldMenu.displayName = 'ProcessMoneyRequestHoldMenu'; | ||
|
||
export default ProcessMoneyRequestHoldMenu; |
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,26 @@ | ||
import React from 'react'; | ||
import {StyleProp, TextStyle} from 'react-native'; | ||
// eslint-disable-next-line no-restricted-imports | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import colors from '@styles/theme/colors'; | ||
import Text from './Text'; | ||
|
||
type TextPillProps = { | ||
/** The color of the text/ */ | ||
color?: string; | ||
|
||
/** Styles to apply to the text */ | ||
textStyles: StyleProp<TextStyle>; | ||
|
||
children: React.ReactNode; | ||
}; | ||
|
||
function TextPill({color, textStyles, children}: TextPillProps) { | ||
const styles = useThemeStyles(); | ||
|
||
return <Text style={[{backgroundColor: color ?? colors.red, borderRadius: 6}, styles.overflowHidden, styles.textStrong, styles.ph2, styles.pv1, textStyles]}>{children}</Text>; | ||
} | ||
|
||
TextPill.displayName = 'TextPill'; | ||
|
||
export default TextPill; |
Oops, something went wrong.