* Add custom popup * Render popup window with react portal * Handle scroll * Handle pointer scroll * Refactor types * Add useOutsideClick * Restore button styles * Update types * Add tests * Set multiple refs * Cleanup * Cleanup * Move offset const to the utils * Add useCallback in useScroll * Remove empty lines in useElementPosition * Change styled components to functional * Make sure popup window stays in view * Highlight trigger button when popup is open * Add uesPopupWindow hook * Make triangle larger * Use full trigger height * Apply new lint rules Co-authored-by: Jaco Greeff <jacogr@gmail.com>
47 lines
993 B
TypeScript
47 lines
993 B
TypeScript
// Copyright 2017-2021 @polkadot/page-accounts authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import React from 'react';
|
|
import styled from 'styled-components';
|
|
|
|
import AccountName from '@polkadot/react-components/AccountName';
|
|
import { Icon } from '@polkadot/react-components/index';
|
|
|
|
interface ParentAccountProps {
|
|
address: string,
|
|
className?: string
|
|
}
|
|
|
|
function ParentAccount ({ address, className }: ParentAccountProps): React.ReactElement<ParentAccountProps> {
|
|
return (
|
|
<div
|
|
className={className}
|
|
data-testid='parent'
|
|
>
|
|
<Icon
|
|
className='parent-icon'
|
|
icon='code-branch'
|
|
/>
|
|
|
|
<AccountName
|
|
value={address}
|
|
withSidebar
|
|
>
|
|
</AccountName>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default React.memo(styled(ParentAccount)`
|
|
align-items: center;
|
|
color: #8B8B8B;
|
|
font-size: 0.75rem;
|
|
display: flex;
|
|
|
|
& .parent-icon {
|
|
font-size: 0.625rem;
|
|
margin-right: 0.3rem;
|
|
margin-left: 0.15rem;
|
|
}
|
|
`);
|