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.

feat: Add file control

Andrey Okonetchnikov3a5ffb50fe0d
diff --git a/app/designer/features/props-panel/control.tsx b/app/designer/features/props-panel/control.tsx
index 3642597088..2a32da7895 100644
--- a/app/designer/features/props-panel/control.tsx
+++ b/app/designer/features/props-panel/control.tsx
@@ -123,10 +123,10 @@ const BooleanControl = ({
const NotImplemented = () => <div />;
-type SimpleControlProps = BaseControlProps & {
+type PrimitiveControlProps = BaseControlProps & {
type:
- | "boolean"
| "array"
+ | "boolean"
| "color"
| "date"
| "number"
@@ -134,6 +134,10 @@ type SimpleControlProps = BaseControlProps & {
| "object"
| "text";
};
+type FileControlProps = BaseControlProps & {
+ type: "file";
+ accept: string;
+};
type OptionsControlProps = BaseControlProps & {
type:
| "radio"
@@ -145,19 +149,24 @@ type OptionsControlProps = BaseControlProps & {
options: Array<string>;
};
-export type ControlProps = SimpleControlProps | OptionsControlProps;
+export type ControlProps =
+ | PrimitiveControlProps
+ | OptionsControlProps
+ | FileControlProps;
// eslint-disable-next-line func-style
export function Control(props: ControlProps) {
switch (props.type) {
- case "boolean":
- return <BooleanControl {...props} />;
case "array":
return <TextControl {...props} />;
+ case "boolean":
+ return <BooleanControl {...props} />;
case "color":
return <TextControl {...props} type="color" />;
case "date":
return <TextControl {...props} type="date" />;
+ case "file":
+ return <TextControl {...props} type="file" />;
case "number":
return <TextControl {...props} type="number" />;
case "range":