From 563559286aca6d55b9f19f7ec4fbd509e326a064 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 6 Jan 2020 12:45:35 +0100 Subject: [PATCH] Disable spellcheck on inputs (#215) * Disable spellcheck on inputs * Cleanup alphabetical attributes --- .../src/components/AddAccount.tsx | 3 +- .../src/components/AddAccountImage.tsx | 74 +++++++++---------- .../extension-ui/src/components/Address.tsx | 40 +++++----- .../extension-ui/src/components/Checkbox.tsx | 4 +- .../extension-ui/src/components/Header.tsx | 17 +++-- .../src/components/InputWithLabel.tsx | 9 ++- packages/extension-ui/src/components/Menu.tsx | 5 +- .../extension-ui/src/components/Settings.tsx | 15 ++-- packages/extension-ui/src/components/Svg.tsx | 8 +- .../src/components/TextAreaWithLabel.tsx | 13 ++-- packages/extension-ui/src/components/View.tsx | 5 +- .../extension-ui/src/components/Warning.tsx | 7 +- 12 files changed, 109 insertions(+), 91 deletions(-) diff --git a/packages/extension-ui/src/components/AddAccount.tsx b/packages/extension-ui/src/components/AddAccount.tsx index 1c16b6c7..67645a70 100644 --- a/packages/extension-ui/src/components/AddAccount.tsx +++ b/packages/extension-ui/src/components/AddAccount.tsx @@ -23,8 +23,7 @@ function AddAccount ({ className }: Props): React.ReactElement { onAction('/account/create')}/>
- You currently don't have any accounts. Either create a new account or if you have an existing - account you wish to use, import it with the seed phrase. + You currently don't have any accounts. Either create a new account or if you have an existing account you wish to use, import it with the seed phrase.
diff --git a/packages/extension-ui/src/components/AddAccountImage.tsx b/packages/extension-ui/src/components/AddAccountImage.tsx index b80a4b93..f6837090 100644 --- a/packages/extension-ui/src/components/AddAccountImage.tsx +++ b/packages/extension-ui/src/components/AddAccountImage.tsx @@ -12,49 +12,49 @@ interface Props { function AddAccountImage ({ onClick, className }: Props): React.ReactElement { return ( - - - + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + d='M145.768 133.776C146.323 133.776 146.792 133.968 147.176 134.352C147.603 134.736 147.816 135.205 147.816 135.76C147.816 136.315 147.624 136.805 147.24 137.232C146.856 137.616 146.365 137.808 145.768 137.808H134.184V149.328C134.184 149.925 133.992 150.416 133.608 150.8C133.224 151.184 132.755 151.376 132.2 151.376C131.645 151.376 131.176 151.184 130.792 150.8C130.408 150.373 130.216 149.883 130.216 149.328V137.808H118.632C118.077 137.808 117.587 137.616 117.16 137.232C116.776 136.805 116.584 136.315 116.584 135.76C116.584 135.205 116.776 134.736 117.16 134.352C117.587 133.968 118.077 133.776 118.632 133.776H130.216V122.256C130.216 121.659 130.408 121.168 130.792 120.784C131.176 120.357 131.645 120.144 132.2 120.144C132.755 120.144 133.224 120.357 133.608 120.784C133.992 121.168 134.184 121.659 134.184 122.256V133.776H145.768Z' + fill='#242529' onClick={onClick} /> - - - - + + + + diff --git a/packages/extension-ui/src/components/Address.tsx b/packages/extension-ui/src/components/Address.tsx index 24582f16..29fdbed8 100644 --- a/packages/extension-ui/src/components/Address.tsx +++ b/packages/extension-ui/src/components/Address.tsx @@ -63,34 +63,33 @@ function Address ({ address, className, children, genesisHash, name, actions }: const [showActionsMenu, setShowActionsMenu] = useState(false); const [moveMenuUp, setIsMovedMenu] = useState(false); const actionsRef = useRef(null); + useOutsideClick(actionsRef, () => (showActionsMenu && setShowActionsMenu(!showActionsMenu))); useEffect((): void => { - if (!address) { - return; - } - const [formatted, account, chain] = recodeAddress(address, accounts, genesisHash); + if (address) { + const [formatted, account, chain] = recodeAddress(address, accounts, genesisHash); - setFormatted(formatted); - setChain(chain); - setAccount(account); + setFormatted(formatted); + setChain(chain); + setAccount(account); + } }, [address]); useEffect(() => { if (!showActionsMenu) { setIsMovedMenu(false); - return; - } - if (!actionsRef.current) { - return; - } - const { bottom } = actionsRef.current.getBoundingClientRect(); - if (bottom > ACCOUNTS_SCREEN_HEIGHT) { - setIsMovedMenu(true); + } else if (actionsRef.current) { + const { bottom } = actionsRef.current.getBoundingClientRect(); + + if (bottom > ACCOUNTS_SCREEN_HEIGHT) { + setIsMovedMenu(true); + } } }, [showActionsMenu]); const theme = ((chain && chain.icon) || 'polkadot') as 'polkadot'; + const _onClick = (): void => setShowActionsMenu(!showActionsMenu); return (
@@ -107,10 +106,17 @@ function Address ({ address, className, children, genesisHash, name, actions }: {actions && ( <> - setShowActionsMenu(!showActionsMenu)}> + {showActionsMenu ? : } - {showActionsMenu && {actions}} + {showActionsMenu && ( + + {actions} + + )} )} diff --git a/packages/extension-ui/src/components/Checkbox.tsx b/packages/extension-ui/src/components/Checkbox.tsx index 451faf3f..bef6d661 100644 --- a/packages/extension-ui/src/components/Checkbox.tsx +++ b/packages/extension-ui/src/components/Checkbox.tsx @@ -19,7 +19,7 @@ function Checkbox ({ onChange, label, className, checked }: Props): React.ReactE