import classNames from "classnames";
import { useState } from "react";
import {
faChevronDown,
faChevronRight,
faTrash,
faCaretDown,
faCaretUp,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { ColorPicker } from "components/color-picker";
import { Range } from "components/range";
import { UploadImage } from "@/components/upload";
import { Switch } from "@/components/switch";
import { login, useUser } from "@/utils/auth";
import { Premium } from "@/components/premium";
import { PremiumOverlay } from "@/components/premium/overlay";
import { FormattedMessage, useIntl } from "react-intl";
import { Label } from "@/components/label";
export const ShapeSelected = ({
shape,
handleChange,
onDelete,
}: {
shape: any;
handleChange: (s: any) => void;
onDelete: () => void;
}) => {
const { user } = useUser();
const intl = useIntl();
const [open, setOpen] = useState(true);
return (
setOpen(!open)}
>
{
e.preventDefault();
e.stopPropagation();
onDelete();
}}
>
{open && (
{shape?.component === "Square" && (
)}
{
const newShape = {
...shape,
transparency: !transparency,
};
handleChange(newShape);
}}
/>
{
let newShape = { ...shape, stringColor: c };
if (c.includes("gradient")) {
const { colors, degrees } = datas;
const gradientType = c?.startsWith("linear")
? "linearGradient"
: "radialGradient";
const angle = c?.startsWith("linear")
? c?.replace("linear-gradient(", "")?.split("deg")?.[0]
: 90;
newShape["gradient"] = {
...newShape.gradient,
enabled: true,
colours: colors,
angle,
type: gradientType,
};
} else {
newShape = {
...newShape,
colour: c,
gradient: {
...shape?.gradient,
enabled: false,
},
};
}
handleChange(newShape);
}}
/>
{
const newShape = {
...shape,
image: {
...shape.image,
enabled,
},
};
handleChange(newShape);
}}
/>
{shape?.image?.enabled && (
{
const newShape = {
...shape,
image: {
...shape.image,
urls,
},
};
handleChange(newShape);
}}
/>
)}
{
const newShape = {
...shape,
border: {
...shape.border,
colour: c,
},
};
handleChange(newShape);
}}
/>
)}
);
};