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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
reusable assets
Oleg Isonena8ca52cdb948
diff --git a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager/asset-manager.tsx b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager/asset-manager.tsxindex 34f2ee3586..6c9d306e9f 100644--- a/apps/designer/app/designer/features/sidebar-left/panels/asset-manager/asset-manager.tsx+++ b/apps/designer/app/designer/features/sidebar-left/panels/asset-manager/asset-manager.tsx@@ -10,13 +10,14 @@ import { Header } from "../../lib/header";import { AssetThumbnail } from "./asset-thumbnail";export const TabContent = ({- assets: baseAssets,+ assets: loadedAssets,onSetActiveTab,}: {onSetActiveTab: (tabName: TabName) => void;assets: Array<BaseAsset>;}) => {- const { assets, onUploadAsset } = useAssets(baseAssets);+ const { assets, onUploadAsset } = useAssets(loadedAssets);+ //console.log(loadedAssets);return (<><Header@@ -31,7 +32,7 @@ export const TabContent = ({css={{ padding: "$1", paddingTop: "$2" }}><Flex justify="end">- <AssetUpload onSubmit={onUploadAsset} />+ <AssetUpload onSubmit={onUploadAsset} accept="image/*" /></Flex><Grid columns={2} gap={2}>{assets.map((asset) => (diff --git a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsxindex f5215677cb..adc80058ca 100644--- a/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx+++ b/apps/designer/app/designer/features/style-panel/controls/font-family/font-family-control.tsx@@ -50,7 +50,6 @@ export const FontFamilyControl = ({return (<Grid columns={2}><PropertyName property={styleConfig.property} label={styleConfig.label} />-<Popover open={isOpen} onOpenChange={setIsOpen}><PopoverTrigger asChild><TextField@@ -59,14 +58,9 @@ export const FontFamilyControl = ({spellCheck={false}readOnlydefaultValue={value.value}- onClick={(event) => {+ onClick={() => {setIsOpen(true);}}- onKeyDown={(event) => {- if (event.key === "Enter") {- // @todo show font picker- }- }}/></PopoverTrigger><PopoverPortal>diff --git a/apps/designer/app/designer/features/style-panel/shared/configs.ts b/apps/designer/app/designer/features/style-panel/shared/configs.tsindex cbdf44a614..3a18f3fbfc 100644--- a/apps/designer/app/designer/features/style-panel/shared/configs.ts+++ b/apps/designer/app/designer/features/style-panel/shared/configs.ts@@ -90,9 +90,9 @@ const getControl = (property: StyleProperty): Control => {case "placeContent": {return "Empty";}- //case "fontFamily": {- // return "FontFamily";- //}+ case "fontFamily": {+ return "FontFamily";+ }}return "Text";diff --git a/apps/designer/app/designer/shared/assets/add-an-asset-form.tsx b/apps/designer/app/designer/shared/assets/asset-upload.tsxsimilarity index 100%rename from apps/designer/app/designer/shared/assets/add-an-asset-form.tsxrename to apps/designer/app/designer/shared/assets/asset-upload.tsxdiff --git a/apps/designer/app/designer/shared/assets/index.ts b/apps/designer/app/designer/shared/assets/index.tsindex 7eebea2737..ae2a760c85 100644--- a/apps/designer/app/designer/shared/assets/index.ts+++ b/apps/designer/app/designer/shared/assets/index.ts@@ -1,3 +1,3 @@-export * from "./add-an-asset-form";+export * from "./asset-upload";export * from "./use-assets";export * from "./types";diff --git a/apps/designer/app/designer/shared/assets/use-assets.ts b/apps/designer/app/designer/shared/assets/use-assets.tsindex 0257fc60e9..ae41467ca0 100644--- a/apps/designer/app/designer/shared/assets/use-assets.ts+++ b/apps/designer/app/designer/shared/assets/use-assets.ts@@ -2,10 +2,9 @@ import { useEffect, useState } from "react";import { useActionData } from "@remix-run/react";import { BaseAsset } from "./types";-export const useAssets = (baseAssets: Array<BaseAsset>) => {+export const useAssets = (initialAssets: Array<BaseAsset>) => {const changes = useActionData();-- const [assets, setAssets] = useState<BaseAsset[]>(baseAssets);+ const [assets, setAssets] = useState<BaseAsset[]>(initialAssets);useEffect(() => {if (changes?.errors) {@@ -28,6 +27,8 @@ export const useAssets = (baseAssets: Array<BaseAsset>) => {}}, [changes]);+ console.log("changes", changes);+const onUploadAsset = (uploadedAssets: Array<BaseAsset>) =>setAssets((assets) => [...uploadedAssets, ...assets]);diff --git a/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx b/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsxindex 363281a7bf..fd0cb35973 100644--- a/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx+++ b/apps/designer/app/designer/shared/fonts-manager/fonts-manager.tsx@@ -6,7 +6,7 @@ export const FontsManager = () => {return (<Flex gap="3" direction="column" css={{ padding: "$1", paddingTop: "$2" }}><Flex justify="end">- <AssetUpload onSubmit={onUploadAsset} />+ <AssetUpload onSubmit={onUploadAsset} accept=".woff2,.woff,.ttf" /></Flex>{assets.map((asset) => asset.name)}</Flex>