ghost-portal/packages/react-components/src/Menu/Base.tsx
MiZiet b4967ca82c
Popup menu replace and styling (#6007)
* 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

* Group popup items into groups suggested by Jaco

Menu.Item is of SUI (semantic UI). It supports icons, but
we plan to replace SUI and thus this feature is likely to use
font awesome instead of SUI icons.

* Remove sui menu

* Improve styles

* Add translations

* Add hover

Co-authored-by: Marcin Wachulski <marcin@ethworks.io>
2021-08-31 10:39:17 +02:00

28 lines
642 B
TypeScript

// Copyright 2017-2021 @polkadot/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BaseProps } from './types';
import React from 'react';
import styled from 'styled-components';
function Base ({ children, className = '' }: BaseProps): React.ReactElement<BaseProps> {
return (
<div className={`ui--Menu ${className}`}>
{children}
</div>
);
}
export default React.memo(styled(Base)`
display: flex;
flex-direction: column;
min-width: 14.286rem;
margin: 1rem 0;
& > *:not(.ui--Menu__Item):not(.ui--Menu__Divider) {
margin-right: 1rem;
margin-left: 1rem;
}
`);