UNPKG

glide-design-system

Version:

Glide design system is an open-source React component library. It offers numerous benefits that make them essential tools for design and development teams.

194 lines (183 loc) 4.24 kB
import React from "react"; // import { storiesOf } from "@storybook/react"; import { Email } from "../../lib"; export default { title: "Components/Email", component: Email, tags: ["autodocs"], argTypes: { onChange: { action: "changed", description: "Function to handle changes in the email input.eg (onChange=(email)=>{consoloe.log(email)})", }, style: { control: "", description: "Additional CSS styles to apply to the Email component for custom styling.", }, value: { control: "text", description: "Value of the email input field.", }, label: { control: "text", description: "Label of the email input field.", }, required: { control: "boolean", description: "Specifies if the fields are required.", defaultValue: false, }, placeHolder: { control: "text", description: "Place holder of the email input field.", }, errorMessage: { control: "text", description: "Displays the error message for an invalid email address.", }, width: { control: "", description: "Custom width of the email input field.", }, height: { control: "", description: "Custom height of the email input field.", }, name: { control: "", description: "The name attribute for the email element.", }, className: { control: "", description: "Additional CSS class names to apply to the email component for custom styling.", }, }, parameters: { docs: { description: { component: "The Email component is used to display and manage e-mail input fields. It accepts various props for customization, including onChange, required, label, value, Place Holders,error message and disabled.", }, }, }, }; const Template = ({ onChange, required, label, value, disabled, errorMessage, placeHolder, style, }) => { return ( <Email onChange={onChange} required={required} label={label} value={value} disabled={disabled} errorMessage={errorMessage} placeHolder={placeHolder} style={style} /> ); }; export const Default = Template.bind({}); Default.args = { onChange: function (event) { return event; }, required: false, label: "Email", value: "johndoe@gmail.com", }; Default.parameters = { docs: { description: { story: "This story demonstrates the Email component with default configuration.", }, }, }; export const PlaceHolder = Template.bind({}); PlaceHolder.args = { label: "Email", placeHolder: "email", }; PlaceHolder.parameters = { docs: { description: { story: "This example shows how to use Email component with placeholder.", }, }, }; export const Style = Template.bind({}); Style.args = { label: "Email", style: { width: "250px" }, }; Style.parameters = { docs: { description: { story: "This example shows how to use Email component with custom width.", }, }, }; export const Required = Template.bind({}); Required.args = { required: true, label: "Email", value: "johndoe@gmail.com", }; Required.parameters = { docs: { description: { story: "This example shows how to use Email component with required property.", }, }, }; export const Disabled = Template.bind({}); Disabled.args = { disabled: true, label: "Email", value: "johndoe@gmail.com", }; Disabled.parameters = { docs: { description: { story: "This example shows how to use Email component with disabled property.", }, }, }; export const Label = Template.bind({}); Label.args = { label: "Email Address", value: "johndoe@gmail.com", }; Label.parameters = { docs: { description: { story: "This example shows how to use Email component with custom label.", }, }, }; export const ErrorMessage = Template.bind({}); ErrorMessage.args = { value: "xyzgma", errorMessage: "Please enter a valid email", }; ErrorMessage.parameters = { docs: { description: { story: "This example shows how to use Email component with custom error message.", }, }, };