From 3bf956a6f2f659e021efce7a45376cfd243a983c Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Mon, 17 Oct 2022 12:54:41 +0200 Subject: [PATCH] move unit select jsx into unit-select and revert Select extensions --- .../shared/css-value-input/unit-select.tsx | 99 ++++++++++++++++--- .../design-system/src/components/select.tsx | 43 +++----- 2 files changed, 102 insertions(+), 40 deletions(-) diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/unit-select.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/unit-select.tsx index aa8691fde8..6d2c6e412b 100644 --- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/unit-select.tsx +++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/unit-select.tsx @@ -1,6 +1,15 @@ -import { Select } from "@webstudio-is/design-system"; -import { type Unit, type UnitValue, StyleValue } from "@webstudio-is/react-sdk"; import { useState, useMemo } from "react"; +import { type Unit, type UnitValue, StyleValue } from "@webstudio-is/react-sdk"; +import * as SelectPrimitive from "@radix-ui/react-select"; +import { + styled, + SelectScrollUpButton, + SelectScrollDownButton, + SelectViewport, + SelectItem, + SelectContent, +} from "@webstudio-is/design-system"; +import { ChevronDownIcon, ChevronUpIcon } from "@webstudio-is/icons"; const unitRenderMap: Map = new Map([ ["px", "PX"], @@ -38,19 +47,22 @@ export const useUnitSelect = ({ () => units.map((unit) => unitRenderMap.get(unit) ?? unit), [units] ); - if (value === undefined) return [isOpen, null]; - const element = ( -