UNPKG

@atlaskit/focused-task-close-account

Version:

This package contains all of the UI components needed to assemble the focused tasks for deactivating and deleting users' accounts in accordance with the GDPR "Right to be forgotten".

80 lines 2.92 kB
import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import React from 'react'; import { FormattedMessage } from 'react-intl-next'; import Button from '@atlaskit/button'; import { Drawer, DrawerCloseButton, DrawerContent, DrawerSidebar } from '@atlaskit/drawer'; import CrossIcon from '@atlaskit/icon/core/cross'; import * as Styled from './styled'; import Footer from '../Footer'; import { commonMessages } from '../../messages'; import MessagesIntlProvider from '../MessagesIntlProvider'; export class FocusedTaskCloseAccount extends React.Component { constructor(...args) { super(...args); _defineProperty(this, "state", { currentScreenIdx: 0 }); _defineProperty(this, "nextScreen", () => { const { screens } = this.props; const { currentScreenIdx } = this.state; const nextScreenIdx = currentScreenIdx < screens.length - 1 ? currentScreenIdx + 1 : screens.length - 1; this.setState({ currentScreenIdx: nextScreenIdx }); }); _defineProperty(this, "previousScreen", () => { const { currentScreenIdx } = this.state; const previousScreenIdx = currentScreenIdx - 1 >= 0 ? currentScreenIdx - 1 : 0; this.setState({ currentScreenIdx: previousScreenIdx }); }); _defineProperty(this, "renderCurrentScreen", () => { const currentScreen = this.props.screens[this.state.currentScreenIdx]; return currentScreen; }); } render() { const { isOpen, onClose, screens, submitButton, learnMoreLink } = this.props; const { currentScreenIdx } = this.state; return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(Drawer, { isOpen: isOpen, onClose: onClose, width: "full" }, /*#__PURE__*/React.createElement(DrawerSidebar, null, /*#__PURE__*/React.createElement(DrawerCloseButton, { icon: props => /*#__PURE__*/React.createElement(CrossIcon, _extends({ color: "currentColor", label: "" }, props)) })), /*#__PURE__*/React.createElement(DrawerContent, null, /*#__PURE__*/React.createElement(Styled.DrawerInner, null, this.renderCurrentScreen(), /*#__PURE__*/React.createElement(Footer, { numScreens: screens.length, currentScreenIdx: currentScreenIdx, onCancel: onClose, onNext: this.nextScreen, onPrevious: this.previousScreen, secondaryActions: learnMoreLink && /*#__PURE__*/React.createElement(Button, { appearance: "subtle-link", spacing: "none", href: learnMoreLink, target: "_blank" }, /*#__PURE__*/React.createElement(FormattedMessage, commonMessages.learnMore), ' '), submitButton: submitButton }))))); } } export default FocusedTaskCloseAccount;