From f5243b4a7659a1d1bfcdfd277db019b9c2107cea Mon Sep 17 00:00:00 2001 From: Milho001 <l.milhomemfrancochristino@uu.nl> Date: Wed, 30 Aug 2023 10:59:12 +0000 Subject: [PATCH] fix(ml_panel): fix ml panel positioning the panel was badly positioned to the right while the button is to the left --- libs/shared/lib/components/Popup.tsx | 7 +++++-- libs/shared/lib/querybuilder/panel/querybuilder.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/shared/lib/components/Popup.tsx b/libs/shared/lib/components/Popup.tsx index a25f44e54..c3c0571ca 100644 --- a/libs/shared/lib/components/Popup.tsx +++ b/libs/shared/lib/components/Popup.tsx @@ -1,10 +1,13 @@ import { useState } from 'react'; -export const Popup = (props: { children: React.ReactNode; open: boolean; vanchor: 'left' | 'right' }) => { +export const Popup = (props: { children: React.ReactNode; open: boolean; hAnchor: 'left' | 'right' }) => { return ( <> {props.open && ( - <div className={`absolute ${props.vanchor}-20 z-10 max-w-[20rem] bg-offwhite-100 flex flex-col gap-2 animate-openmenu`}> + <div + className="absolute z-10 max-w-[20rem] bg-offwhite-100 flex flex-col gap-2 animate-openmenu" + style={props.hAnchor === 'left' ? { left: '5rem' } : { right: '5rem' }} + > {props.children} </div> )} diff --git a/libs/shared/lib/querybuilder/panel/querybuilder.tsx b/libs/shared/lib/querybuilder/panel/querybuilder.tsx index 912712627..09945f312 100644 --- a/libs/shared/lib/querybuilder/panel/querybuilder.tsx +++ b/libs/shared/lib/querybuilder/panel/querybuilder.tsx @@ -450,7 +450,7 @@ export const QueryBuilderInner = (props: QueryBuilderProps) => { onDrag={() => {}} /> </Dialog> - <Popup open={openMLDialog} vanchor="right"> + <Popup open={openMLDialog} hAnchor="right"> <QueryBuilderMLPanel /> </Popup> <ReactFlow -- GitLab