Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | import styled from '@emotion/styled'; import { memo, useCallback, useEffect, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { Modal, TextArea } from '@allshares/studio-design-system'; const StyledTextArea = styled(TextArea)` min-height: 200px; resize: vertical; `; interface EditTokenDescriptionModalProps { readonly onClose: () => void; readonly onConfirm: (description: string) => void; readonly isOpen: boolean; readonly tokenName: string; readonly tokenDescription?: string | null; readonly isConfirmPending: boolean; } export const EditTokenDescriptionModal = memo(function EditTokenDescriptionModal({ onClose, onConfirm, tokenName, tokenDescription, isOpen, isConfirmPending, }: EditTokenDescriptionModalProps) { const [description, setDescription] = useState<string>(tokenDescription ?? ''); const handleClickApply = useCallback(() => { onConfirm(description); }, [description, onConfirm]); useEffect(() => { setDescription(tokenDescription ?? ''); }, [tokenDescription]); return ( <Modal isOpen={isOpen} onClose={onClose} > <Modal.Content> <Modal.Header> <Modal.Title>{tokenName}</Modal.Title> </Modal.Header> <Modal.Body> <StyledTextArea label={<FormattedMessage defaultMessage="Description" />} value={description} onChange={setDescription} /> </Modal.Body> </Modal.Content> <Modal.Actions> <Modal.CancelAction /> <Modal.MainAction isLoading={isConfirmPending} onClick={handleClickApply} > <FormattedMessage defaultMessage="Apply" /> </Modal.MainAction> </Modal.Actions> </Modal> ); }); |