import React from "react"; import { Box } from "rebass"; import { Input } from "@rebass/forms"; import Dialog, { showDialog } from "./dialog"; import * as Icon from "react-feather"; function PasswordDialog(props) { let password = ""; return ( (password = e.target.value)} placeholder="Enter vault password" /> } positiveButton={{ text: props.positiveButtonText, onClick: () => props.onDone(password) }} negativeButton={{ text: "Cancel", onClick: props.onCancel }} /> ); } function getDialogData(type) { switch (type) { case "create_vault": return { title: "Set Up Your Vault", icon: Icon.Shield, positiveButtonText: "Done" }; case "unlock_vault": return { title: "Unlock Vault", icon: Icon.Unlock, positiveButtonText: "Unlock" }; case "unlock_note": return { title: "Unlock Note", icon: Icon.Unlock, positiveButtonText: "Unlock" }; default: return; } } export const showPasswordDialog = type => { const { title, icon, positiveButtonText } = getDialogData(type); return showDialog(perform => ( perform()} onDone={password => perform(password)} /> )); };