From f7a647abb45dcd16558eda804202ccce634eaa05 Mon Sep 17 00:00:00 2001 From: Oleg Isonen Date: Sat, 15 Oct 2022 11:54:19 +0200 Subject: [PATCH] limit the units --- .../shared/css-value-input/css-value-input.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx index 931a1186e2..aa226aaf9f 100644 --- a/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx +++ b/apps/designer/app/designer/features/style-panel/shared/css-value-input/css-value-input.tsx @@ -19,7 +19,6 @@ import { type UnitValue, type UnsetValue, StyleValue, - units as unsortedUnits, } from "@webstudio-is/react-sdk"; import { type KeyboardEventHandler, @@ -29,12 +28,16 @@ import { useState, } from "react"; -// @todo sorting doesn't work -export const defaultUnits: Array = [...unsortedUnits].sort((unit) => - ["px", "%", "em", "rem", "ch", "vw", "vh", "vmin", "vmax"].includes(unit) - ? -1 - : 1 -); +export const defaultUnits: Array = [ + "px", + "em", + "rem", + "ch", + "vw", + "vh", + "%", + "number", +]; const defaultKeywords: [] = []; const defaultValue: UnsetValue = { type: "unset", value: "" };