fix: added props interface to new components

This commit is contained in:
anjy7
2023-10-30 19:12:07 +05:30
parent 8546ce918c
commit 0809055247
4 changed files with 26 additions and 8 deletions

View File

@@ -1,7 +1,13 @@
import { useState } from "react";
import { TSurvey } from "@formbricks/types/surveys";
export default function AnimatedSurveyBg({ localSurvey, handleBgChange }) {
const [color, setColor] = useState(localSurvey.surveyBackground?.bg || "#ffff");
interface AnimatedSurveyBgProps {
localSurvey?: TSurvey;
handleBgChange: (bg: string, bgType: string) => void;
}
export default function AnimatedSurveyBg({ localSurvey, handleBgChange }: AnimatedSurveyBgProps) {
const [color, setColor] = useState(localSurvey?.surveyBackground?.bg || "#ffff");
const [hoveredVideo, setHoveredVideo] = useState<number | null>(null);
const animationFiles = {

View File

@@ -1,8 +1,14 @@
import { useState } from "react";
import { ColorPicker } from "@formbricks/ui/ColorPicker";
import { Label } from "@formbricks/ui/Label";
import { TSurvey } from "@formbricks/types/surveys";
export default function ColorSurveyBg({ localSurvey, handleBgChange }) {
interface ColorSurveyBgBgProps {
localSurvey?: TSurvey;
handleBgChange: (bg: string, bgType: string) => void;
}
export default function ColorSurveyBg({ localSurvey, handleBgChange }: ColorSurveyBgBgProps) {
const colours = [
"#FFF2D8",
"#EAD7BB",
@@ -30,7 +36,7 @@ export default function ColorSurveyBg({ localSurvey, handleBgChange }) {
"#CDFAD5",
];
const [color, setColor] = useState(localSurvey.surveyBackground?.bg || "#ffff");
const [color, setColor] = useState(localSurvey?.surveyBackground?.bg || "#ffff");
const handleBg = (x: string) => {
setColor(x);

View File

@@ -1,14 +1,20 @@
import FileInput from "@formbricks/ui/FileInput";
import { TSurvey } from "@formbricks/types/surveys";
export default function ImageSurveyBg({ localSurvey, handleBgChange }) {
interface ImageSurveyBgBgProps {
localSurvey?: TSurvey;
handleBgChange: (url: string, bgType: string) => void;
}
export default function ImageSurveyBg({ localSurvey, handleBgChange }: ImageSurveyBgBgProps) {
return (
<div className="mb-2 mt-4 w-full rounded-lg border bg-slate-50 p-4">
<div className="mt-3 flex w-full items-center justify-center">
<FileInput
id="choices-file-input"
allowedFileExtensions={["png", "jpeg", "jpg"]}
environmentId={localSurvey.environmentId}
onFileUpload={(url: string[]) => {
environmentId={localSurvey?.environmentId}
onFileUpload={(url: string) => {
handleBgChange(url, "image");
}}
fileUrl={localSurvey?.welcomeCard?.fileUrl}

View File

@@ -17,7 +17,7 @@ interface FileInputProps {
id: string;
allowedFileExtensions: TAllowedFileExtensions[];
environmentId: string | undefined;
onFileUpload: (uploadedUrl: string[] | undefined) => void;
onFileUpload: (uploadedUrl: string[] | string | undefined) => void;
fileUrl?: string | string[];
multiple?: boolean;
}