Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

amount of items has to be the same, otherwise downshift gets confused

Oleg Isonenba3d310ba308
diff --git a/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx b/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx
index 9bccfebb00..a67f3dd2cb 100644
--- a/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx
+++ b/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx
@@ -19,6 +19,11 @@ type Item = {
type: "uploaded" | "system" | "category";
};
+const categoryItems = {
+ uploaded: { label: "Uploaded", type: "category" },
+ system: { label: "System", type: "category" },
+};
+
const getItems = (assets: Array<Asset | PreviewAsset>): Array<Item> => {
const system = Array.from(SYSTEM_FONTS.keys()).map((label) => ({
label,
@@ -35,7 +40,12 @@ const getItems = (assets: Array<Asset | PreviewAsset>): Array<Item> => {
});
}
}
- return [...uploaded.values(), ...system];
+ return [
+ categoryItems.uploaded,
+ ...uploaded.values(),
+ categoryItems.system,
+ ...system,
+ ];
};
const groupItems = (items: Array<Item>) => {
@@ -44,11 +54,11 @@ const groupItems = (items: Array<Item>) => {
const result = [];
if (uploaded.length !== 0) {
- result.push({ label: "Uploaded", type: "category" }, ...uploaded);
+ result.push(categoryItems.uploaded, ...uploaded);
}
if (system.length !== 0) {
- result.push({ label: "System", type: "category" }, ...system);
+ result.push(categoryItems.system, ...system);
}
return result;