From f2e872ce3f8f8868b4c485544a9a0219748f3a22 Mon Sep 17 00:00:00 2001 From: brendanlaschke Date: Thu, 10 Aug 2023 17:02:47 +0200 Subject: [PATCH] - context menu vertical --- .../ui/action-bar/components/ActionBar.tsx | 45 ++++++++++++++++--- .../components/EntityTableActionBarButton.tsx | 5 ++- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/front/src/modules/ui/action-bar/components/ActionBar.tsx b/front/src/modules/ui/action-bar/components/ActionBar.tsx index ff36ab0932..72f7d8361c 100644 --- a/front/src/modules/ui/action-bar/components/ActionBar.tsx +++ b/front/src/modules/ui/action-bar/components/ActionBar.tsx @@ -15,21 +15,46 @@ type StyledContainerProps = { position: PositionType; }; -const StyledContainer = styled.div` +const StyledContainerContextMenu = styled.div` align-items: center; background: ${({ theme }) => theme.background.secondary}; border: 1px solid ${({ theme }) => theme.border.color.medium}; border-radius: ${({ theme }) => theme.border.radius.md}; bottom: ${(props) => (props.position.x ? 'auto' : '38px')}; box-shadow: ${({ theme }) => theme.boxShadow.strong}; + + left: ${(props) => (props.position.x ? `${props.position.x}px` : '50%')}; + padding-bottom: ${({ theme }) => theme.spacing(1)}; + padding-left: ${({ theme }) => theme.spacing(1)}; + padding-right: ${({ theme }) => theme.spacing(1)}; + padding-top: ${({ theme }) => theme.spacing(1)}; + position: ${(props) => (props.position.x ? 'fixed' : 'absolute')}; + top: ${(props) => (props.position.y ? `${props.position.y}px` : 'auto')}; + + transform: translateX(-50%); + width: 160px; + z-index: 1; + + div { + justify-content: left; + } +`; + +const StyledContainerActionBar = styled.div` + align-items: center; + background: ${({ theme }) => theme.background.secondary}; + border: 1px solid ${({ theme }) => theme.border.color.medium}; + border-radius: ${({ theme }) => theme.border.radius.md}; + bottom: 38px; + box-shadow: ${({ theme }) => theme.boxShadow.strong}; display: flex; height: 48px; - left: ${(props) => (props.position.x ? `${props.position.x}px` : '50%')}; + left: 50%; padding-left: ${({ theme }) => theme.spacing(2)}; padding-right: ${({ theme }) => theme.spacing(2)}; - position: ${(props) => (props.position.x ? 'fixed' : 'absolute')}; - top: ${(props) => (props.position.y ? `${props.position.y}px` : 'auto')}; + position: absolute; + top: auto; transform: translateX(-50%); z-index: 1; @@ -57,10 +82,16 @@ export function ActionBar({ children, selectedIds }: OwnProps) { if (selectedIds.length === 0) { return null; } - + if (position.x && position.y) { + return ( + + {children} + + ); + } return ( - + {children} - + ); } diff --git a/front/src/modules/ui/table/action-bar/components/EntityTableActionBarButton.tsx b/front/src/modules/ui/table/action-bar/components/EntityTableActionBarButton.tsx index 911995198e..523efe511e 100644 --- a/front/src/modules/ui/table/action-bar/components/EntityTableActionBarButton.tsx +++ b/front/src/modules/ui/table/action-bar/components/EntityTableActionBarButton.tsx @@ -27,7 +27,10 @@ const StyledButton = styled.div` user-select: none; &:hover { - background: ${({ theme }) => theme.background.tertiary}; + background: ${({ theme, type }) => + type === 'warning' + ? theme.tag.background.red + : theme.background.tertiary}; } `;