-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2019-2021 @polkadot/extension-ui authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { ThemeProps } from '../types'; | ||
|
||
import { IconProp } from '@fortawesome/fontawesome-svg-core'; | ||
import { faTimes } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import React, { useCallback, useContext } from 'react'; | ||
import { RouteComponentProps, withRouter } from 'react-router'; | ||
import styled from 'styled-components'; | ||
|
||
import { ActionContext, Address, VerticalSpace, } from '../components'; | ||
Check failure on line 13 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check failure on line 13 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check failure on line 13 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
import useTranslation from '../hooks/useTranslation'; | ||
import { Header } from '../partials'; | ||
import QRCodeComponent from '../partials/QrCodeComponent'; | ||
|
||
|
||
Check failure on line 18 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
interface Props extends RouteComponentProps<{address: string}>, ThemeProps { | ||
className?: string; | ||
} | ||
|
||
function AddressQr ({ className, match: { params: { address } } }: Props): React.ReactElement<Props> { | ||
const { t } = useTranslation(); | ||
const onAction = useContext(ActionContext); | ||
|
||
const _goHome = useCallback( | ||
() => onAction('/'), | ||
[onAction] | ||
); | ||
|
||
|
||
Check failure on line 32 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
return ( | ||
<> | ||
<Header | ||
showLogo | ||
text={t<string>('Account QR')}> | ||
<div className='steps'> | ||
<button | ||
className='popup__close-btn' | ||
type='button' | ||
onClick={_goHome}> | ||
<FontAwesomeIcon | ||
className='popup__close-btn-icon' | ||
icon={faTimes as IconProp} | ||
title='Close' | ||
/> | ||
</button> | ||
</div> | ||
</Header> | ||
<div className={className}> | ||
<Address | ||
Check failure on line 52 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
address={address} | ||
exporting | ||
presentation | ||
> | ||
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}> | ||
Check failure on line 57 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
<QRCodeComponent value={address} size={256}/> | ||
Check failure on line 58 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check warning on line 58 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check failure on line 58 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check failure on line 58 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
Check warning on line 58 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
</div> | ||
Check failure on line 59 in packages/extension-ui/src/Popup/AddressQr.tsx GitHub Actions / lint
|
||
</Address> | ||
</div> | ||
<VerticalSpace /> | ||
</> | ||
); | ||
} | ||
|
||
export default withRouter(styled(AddressQr)` | ||
margin-top: 15px; | ||
.actionArea { | ||
padding: 10px 24px; | ||
} | ||
.movedWarning { | ||
margin-top: 8px; | ||
} | ||
`); |