import * as React from "react"; import { useState } from "react"; import { Icon } from "@sc/plugins/webcomponents/v2"; import { IconTypes } from "@sc/plugins/webcomponents/v2/Icon"; import { CaptionProps } from "./types"; import style from "./style"; import Typography from "@sc/modules/page/Builder/Properties/Sections/Typography"; /** * Creates a caption group for gathering input data */ const Caption: React.FC = (props) => { const { value, placeholder, text, onChange, showTypography = false, setCanDrag = (value) => false, } = props; const [caption, setCaption] = useState(value); return (
{text || "Caption"}
(this.input = el)} onMouseDown={() => setCanDrag(false)} onMouseUp={() => setCanDrag(true)} onChange={(e) => { setCaption(e.target.value); }} onBlur={(e) => { setCanDrag(true); onChange(e.target.value); }} style={{ padding: 10, // float: "left", width: "100%", // borderRadius: 5, // border: "1px solid #CCC", border: "none", // margin: "5px 0", fontSize: 14, }} />
{ setCaption(""); onChange(""); }} style={{ zoom: 0.65, cursor: "pointer", padding: 16, color: "#CCC", }} >
{showTypography && ( )}
); }; export default Caption;