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

[BX-832] Dismiss Alert prompts by clicking blurred background area #698

Merged
merged 5 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion src/design-system/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Alert = () => {
if (!visible) return null;

return (
<Prompt zIndex={zIndexes.ALERT} show={visible}>
<Prompt zIndex={zIndexes.ALERT} show={visible} handleClose={onClose}>
<Box padding="20px">
<Stack space="20px">
<Box style={{ wordBreak: 'break-all' }}>
Expand Down
6 changes: 6 additions & 0 deletions src/design-system/components/Prompt/Prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const Prompt = ({
scrimBackground,
backdropFilter,
zIndex,
handleClose,
}: {
show: boolean;
children: ReactNode;
Expand All @@ -27,6 +28,7 @@ export const Prompt = ({
scrimBackground?: boolean;
backdropFilter?: BackdropFilter;
zIndex?: number;
handleClose?: () => void;
}) => {
const emphasizedShort = animatedRouteTransitionConfig['emphasizedShort'];
const deceleratedShort = animatedRouteTransitionConfig['deceleratedShort'];
Expand Down Expand Up @@ -76,6 +78,7 @@ export const Prompt = ({
backdropFilter={backdropFilter ?? 'blur(12px)'}
background="scrim"
padding={padding}
onClick={() => handleClose?.()}
>
<Rows alignVertical="center">
<Row height="content">
Expand All @@ -86,6 +89,9 @@ export const Prompt = ({
}}
>
<Box
onClick={(e) => {
e.stopPropagation();
}}
as={motion.div}
initial={{ opacity: 0, scale: 1.1 }}
animate={{ opacity: 1, scale: 1 }}
Expand Down
4 changes: 3 additions & 1 deletion src/entries/popup/pages/send/ContactPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const ContactPrompt = ({
address,
action,
onSaveContactAction,
handleClose,
}: {
show: boolean;
address: Address;
Expand All @@ -220,13 +221,14 @@ export const ContactPrompt = ({
action: ContactAction;
}>
>;
handleClose: () => void;
}) => {
const { data: ensAvatar } = useENSAvatar({ addressOrName: address });
const { data: dominantColor } = useDominantColor({
imageUrl: ensAvatar ?? undefined,
});
return (
<Prompt show={show}>
<Prompt show={show} handleClose={handleClose}>
<Box padding="12px">
<AccentColorProvider color={dominantColor || globalColors.blue50}>
{action === 'save' || action === 'edit' ? (
Expand Down
3 changes: 3 additions & 0 deletions src/entries/popup/pages/send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ export function Send() {
show={contactSaveAction?.show}
action={contactSaveAction?.action}
onSaveContactAction={setSaveContactAction}
handleClose={() =>
setSaveContactAction({ show: false, action: 'save' })
}
/>
<AccentColorProviderWrapper color={assetAccentColor}>
<ReviewSheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const ConfirmPasswordPrompt = ({
}, []);

return (
<Prompt show={show}>
<Prompt handleClose={handleClose} show={show}>
<Box padding="12px">
<Rows space="24px">
<Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const NewWalletPrompt = ({
);

return (
<Prompt show={show}>
<Prompt show={show} handleClose={onClose}>
<Box padding="12px">
<Rows space="24px">
<Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const RemoveWalletPrompt = ({
};

return (
<Prompt show={show}>
<Prompt show={show} handleClose={onClose}>
<Box padding="12px">
<Rows space="24px">
<Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const RenameWalletPrompt = ({
onClose: () => void;
account?: Address;
}) => (
<Prompt show={!!account}>
<Prompt show={!!account} handleClose={onClose}>
{account && <RenameWallet account={account} onClose={onClose} />}
</Prompt>
);