Snap removal confirmation (#13619)
* Add Snap removal confirmation * Add styling for Snap removal confirmation * Update styling * Update button margin * Re-use styling code * Address comments * Update Popover props * Lint * Lint Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com> Co-authored-by: Erik Marks <rekmarks@protonmail.com>feature/default_network_editable
parent
e795c29b3f
commit
0461bbcded
@ -0,0 +1 @@ |
|||||||
|
export { default } from './snap-remove-warning'; |
@ -0,0 +1,12 @@ |
|||||||
|
.snap-remove-warning { |
||||||
|
color: var(--black); |
||||||
|
|
||||||
|
&__footer-button { |
||||||
|
height: 40px; |
||||||
|
margin-inline-end: 24px; |
||||||
|
|
||||||
|
&:last-of-type { |
||||||
|
margin-inline-end: 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
import React from 'react'; |
||||||
|
import PropTypes from 'prop-types'; |
||||||
|
import { useI18nContext } from '../../../../hooks/useI18nContext'; |
||||||
|
import Typography from '../../../ui/typography/typography'; |
||||||
|
import { TYPOGRAPHY } from '../../../../helpers/constants/design-system'; |
||||||
|
import Box from '../../../ui/box/box'; |
||||||
|
import Popover from '../../../ui/popover'; |
||||||
|
import Button from '../../../ui/button'; |
||||||
|
|
||||||
|
export default function SnapRemoveWarning({ onCancel, onSubmit, snapName }) { |
||||||
|
const t = useI18nContext(); |
||||||
|
|
||||||
|
const SnapRemoveWarningFooter = () => { |
||||||
|
return ( |
||||||
|
<> |
||||||
|
<Button |
||||||
|
className="snap-remove-warning__footer-button" |
||||||
|
type="default" |
||||||
|
onClick={onCancel} |
||||||
|
> |
||||||
|
{t('nevermind')} |
||||||
|
</Button> |
||||||
|
<Button |
||||||
|
className="snap-remove-warning__footer-button" |
||||||
|
type="danger-primary" |
||||||
|
onClick={onSubmit} |
||||||
|
> |
||||||
|
{t('removeSnap')} |
||||||
|
</Button> |
||||||
|
</> |
||||||
|
); |
||||||
|
}; |
||||||
|
|
||||||
|
return ( |
||||||
|
<Popover |
||||||
|
className="snap-remove-warning" |
||||||
|
title={t('pleaseConfirm')} |
||||||
|
footer={<SnapRemoveWarningFooter />} |
||||||
|
onClose={onCancel} |
||||||
|
headerProps={{ padding: [6, 4, 0, 6] }} |
||||||
|
> |
||||||
|
<Box paddingRight={4} paddingBottom={4} paddingLeft={6}> |
||||||
|
<Typography variant={TYPOGRAPHY.H4}> |
||||||
|
{t('removeSnapConfirmation', [snapName])} |
||||||
|
</Typography> |
||||||
|
</Box> |
||||||
|
</Popover> |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
SnapRemoveWarning.propTypes = { |
||||||
|
/** |
||||||
|
* onCancel handler |
||||||
|
*/ |
||||||
|
onCancel: PropTypes.func, |
||||||
|
/** |
||||||
|
* onSubmit handler |
||||||
|
*/ |
||||||
|
onSubmit: PropTypes.func, |
||||||
|
/** |
||||||
|
* Name of snap |
||||||
|
*/ |
||||||
|
snapName: PropTypes.string, |
||||||
|
}; |
Loading…
Reference in new issue