From 4f21580471aa833ca7e04478548f08044261957f Mon Sep 17 00:00:00 2001 From: Ankita Kinger Date: Thu, 15 May 2025 19:33:55 +0530 Subject: [PATCH] fix: Updating the styles for JS settings popover (#40660) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Updating the styles for JS settings popover Fixes #40657 ## Automation /ok-to-test tags="@tag.JS" ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 0346eec44945dee8b0a98ece911e23f36709c5b2 > Cypress dashboard. > Tags: `@tag.JS` > Spec: >
Thu, 15 May 2025 13:49:10 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No ## Summary by CodeRabbit - **New Features** - Added the ability to customize the width of the settings popover in toolbars. - **Style** - Improved text wrapping for function names in the function settings panel. - Adjusted spacing and set a minimum width for dropdown selectors to enhance layout consistency. --- .../src/IDE/Components/ToolbarSettingsPopover.tsx | 14 +++++++------- .../JSEditor/JSEditorToolbar/JSEditorToolbar.tsx | 1 + .../components/JSFunctionSettings.tsx | 14 +++++++++++--- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/client/src/IDE/Components/ToolbarSettingsPopover.tsx b/app/client/src/IDE/Components/ToolbarSettingsPopover.tsx index 3a2e8d2666..d3f9fd6a02 100644 --- a/app/client/src/IDE/Components/ToolbarSettingsPopover.tsx +++ b/app/client/src/IDE/Components/ToolbarSettingsPopover.tsx @@ -7,7 +7,7 @@ import { PopoverTrigger, ToggleButton, } from "@appsmith/ads"; -import styled, { css } from "styled-components"; +import styled from "styled-components"; interface Props { isOpen: boolean; @@ -16,21 +16,20 @@ interface Props { children: React.ReactNode; dataTestId?: string; disabled?: boolean; + popoverWidth?: string; } -const Variables = css` - --popover-width: 280px; -`; const StyledPopoverHeader = styled(PopoverHeader)` margin-bottom: var(--ads-v2-spaces-5); `; -const StyledPopoverContent = styled(PopoverContent)` - ${Variables}; +const StyledPopoverContent = styled(PopoverContent)<{ popoverWidth?: string }>` + --popover-width: ${({ popoverWidth }) => + popoverWidth ? popoverWidth : "280px"}; `; export const ToolbarSettingsPopover = (props: Props) => { - const { handleOpenChange, isOpen, title } = props; + const { handleOpenChange, isOpen, popoverWidth, title } = props; const handleButtonClick = useCallback(() => { handleOpenChange(true); }, [handleOpenChange]); @@ -54,6 +53,7 @@ export const ToolbarSettingsPopover = (props: Props) => { {title} diff --git a/app/client/src/ce/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx b/app/client/src/ce/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx index 8357b14813..54bed87617 100644 --- a/app/client/src/ce/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx +++ b/app/client/src/ce/pages/Editor/JSEditor/JSEditorToolbar/JSEditorToolbar.tsx @@ -75,6 +75,7 @@ export const JSEditorToolbar = (props: Props) => { dataTestId={"t--js-settings-trigger"} handleOpenChange={setIsOpen} isOpen={isOpen} + popoverWidth="345px" title={createMessage(JS_EDITOR_SETTINGS.TITLE)} > { - + {props.action.name} - +