import * as React from "react"; import styled from "styled-components"; import { get } from "lodash"; import { EditorMode } from "@sc/modules/v2/Editor/types"; import { Icon } from "../"; interface WrapperFields { style?: React.CSSProperties; children: React.ReactNode; } const Wrapper: React.FC = ({ style, children }) => { return (
{children}
); }; interface SProps { mode?: EditorMode; inputStyle: any; } const Inpt = styled.input` &::placeholder { color: ${(p) => get(p.inputStyle, "color", "inherit")}; } box-sizing: border-box; `; const Select = styled.select` &::placeholder { color: ${(p) => get(p.inputStyle, "color", "inherit")}; } box-sizing: border-box; `; const Textarea = styled.textarea` &::placeholder { color: ${(p) => get(p.inputStyle, "color", "inherit")}; } box-sizing: border-box; `; export const FormField: React.FC = ({ children, type, name, label, style, inputStyle, labelStyle, placeholder, defaultValue, icon, iconStyle, options, }) => { if (type === "Text" || type === "Password") return ( {label &&
{label}
}
{icon && ( )}
); if (type === "Select") { return ( {label &&
{label}
}
); } if (type === "Textarea") { return ( {label &&
{label}
}
); } if (type === "Checkbox") { return ( ); } if (type === "Radio") { return ( ); } return {children}; }; export default FormField;