This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added newform and form dashboard pages
- Loading branch information
Showing
7 changed files
with
375 additions
and
135 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { Dropdown, Input, Button, Space } from 'antd'; | ||
import { AiOutlineDown } from 'react-icons/ai'; | ||
|
||
export default function CustomParameter() { | ||
const items = [ | ||
{ | ||
label: '1st menu item', | ||
key: '1', | ||
icon: '', | ||
}, | ||
{ | ||
label: '2nd menu item', | ||
key: '2', | ||
icon: '', | ||
}, | ||
{ | ||
label: '3rd menu item', | ||
key: '3', | ||
icon: '', | ||
}, | ||
{ | ||
label: '4rd menu item', | ||
key: '4', | ||
icon: '', | ||
}, | ||
]; | ||
const menuProps = { | ||
items, | ||
onClick: handleMenuClick, | ||
}; | ||
const handleMenuClick = (e) => { | ||
console.log('click', e); | ||
}; | ||
return ( | ||
<> | ||
<div className="flex flex-row justify-around gap-4 items-center"> | ||
<div> | ||
<Dropdown menu={menuProps}> | ||
<Button className="rounded-lg" size="large"> | ||
<Space> | ||
Custom Option Type | ||
<AiOutlineDown /> | ||
</Space> | ||
</Button> | ||
</Dropdown> | ||
</div> | ||
<div className="w-full"> | ||
<Input placeholder="Custom Option Value" className="rounded-lg " /> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
import { Input, Checkbox, Dropdown, Button, Space } from 'antd'; | ||
import { AiOutlineDown, AiOutlinePlus } from 'react-icons/ai'; | ||
import CustomParameter from '../CustomParameterInput'; | ||
export default function FormInput() { | ||
const items = [ | ||
{ | ||
label: '1st menu item', | ||
key: '1', | ||
icon: '', | ||
}, | ||
{ | ||
label: '2nd menu item', | ||
key: '2', | ||
icon: '', | ||
}, | ||
{ | ||
label: '3rd menu item', | ||
key: '3', | ||
icon: '', | ||
}, | ||
{ | ||
label: '4rd menu item', | ||
key: '4', | ||
icon: '', | ||
}, | ||
]; | ||
const menuProps = { | ||
items, | ||
onClick: handleMenuClick, | ||
}; | ||
const handleMenuClick = (e) => { | ||
console.log('click', e); | ||
}; | ||
return ( | ||
<> | ||
<div className="border-2 rounded-lg p-4 flex flex-col gap-2"> | ||
<div className="flex flex-row justify-around gap-4 items-center"> | ||
<div> | ||
<Dropdown menu={menuProps}> | ||
<Button className="rounded-lg" size="large"> | ||
<Space> | ||
Field Type | ||
<AiOutlineDown /> | ||
</Space> | ||
</Button> | ||
</Dropdown> | ||
</div> | ||
<div className="w-full"> | ||
<Input | ||
placeholder="Field Name (as per HTML)" | ||
className="rounded-lg " | ||
/> | ||
</div> | ||
<div> | ||
<Checkbox>Required</Checkbox> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-2"> | ||
<CustomParameter /> | ||
</div> | ||
<div className="self-end"> | ||
<button className="rounded-lg bg-[#DEF7E5] text-[#023430] font-semibold p-1 px-2 "> | ||
<Space> | ||
<AiOutlinePlus size={16} strokeWidth={12} /> | ||
Add a Custom Parameter | ||
</Space> | ||
</button> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
export default function FormResponse({ response }) { | ||
return ( | ||
<> | ||
<div className="border-2 rounded-lg"> | ||
<div className="p-4 flex flex-col"> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">Name:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Manas Gupta</div> | ||
</div> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">City:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Ludhiana</div> | ||
</div> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">State:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Punjab</div> | ||
</div> | ||
<div className="self-end text-[#001e2b] italic text-xs"> | ||
Submittted a week ago | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,60 @@ | ||
import React from "react"; | ||
const options = { | ||
email: { type: 'string', format: 'email' }, | ||
checkbox: { type: 'boolean' }, | ||
color: { | ||
type: 'string', | ||
pattern: '^#[0-9a-f]{3}([0-9a-f]{3})?$', | ||
}, | ||
date: { type: 'string', format: 'date' }, | ||
'datetime-local': { type: 'string', format: 'date-time' }, | ||
image: { | ||
type: 'string', | ||
format: 'uri', | ||
}, | ||
hidden: { type: 'boolean' }, | ||
month: { type: 'integer', minimum: 1, maximum: 12 }, | ||
number: { type: 'number' }, | ||
radio: { type: 'boolean' }, | ||
range: { type: 'number' }, | ||
reset: { type: 'boolean' }, | ||
search: { type: 'string' }, | ||
tel: { | ||
type: 'string', | ||
minLength: 10, | ||
maxLength: 20, | ||
pattern: '^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$', | ||
}, | ||
text: { type: 'string' }, | ||
time: { type: 'string', format: 'time' }, | ||
url: { type: 'string', format: 'uri' }, | ||
week: { type: 'number', minimum: 1, maximum: 53 }, | ||
file: { type: 'string', format: 'uri' }, | ||
password: { type: 'string' }, | ||
}; | ||
|
||
const createJSONSchema = (inputs) => { | ||
let JSONSchema = { | ||
type: "object", | ||
type: 'object', | ||
properties: {}, | ||
isRequired: [], | ||
required: [], | ||
additionalProperties: false, | ||
}; | ||
inputs.forEach((input) => { | ||
JSONSchema.properties[input.name] = options[input.type]; | ||
if (input.isRequired) { | ||
JSONSchema.isRequired.push(input.name); | ||
JSONSchema.required.push(input.name); | ||
} | ||
}); | ||
console.log(JSONSchema); | ||
return JSONSchema; | ||
}; | ||
createJSONSchema([ | ||
{ name: 'name', type: 'text', isRequired: true }, | ||
{ name: 'email', type: 'email', isRequired: true }, | ||
{ name: 'password', type: 'password', isRequired: true }, | ||
{ name: 'checkbox', type: 'checkbox', isRequired: true }, | ||
{ name: 'color', type: 'color', isRequired: true }, | ||
{ name: 'date', type: 'date', isRequired: true }, | ||
]); | ||
|
||
const options = { | ||
email: { type: "string", format: "email" }, | ||
checkbox: { type: "boolean" }, | ||
color: { | ||
type: "string", | ||
pattern: | ||
"^#([da-f]{3}){1,2}$|^#([da-f]{4}){1,2}$|(rgb|hsl)a?((s*-?d+%?s*,){2}(s*-?d+%?s*,?s*)?)(,s*(0?.d+)?|1)?)", | ||
}, | ||
date: { type: "string", format: "date" }, | ||
"datetime-local": { type: "string", format: "date-time" }, | ||
image: { | ||
type: "string", | ||
format: "uri", | ||
}, | ||
hidden: { type: "boolean" }, | ||
month: { type: "integer", minimum: 1, maximum: 12 }, | ||
number: { type: "number" }, | ||
radio: { type: "boolean" }, | ||
range: { type: "number" }, | ||
reset: { type: "boolean" }, | ||
search: { type: "string" }, | ||
tel: { | ||
type: "string", | ||
minLength: 10, | ||
maxLength: 20, | ||
pattern: "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$", | ||
}, | ||
text: { type: "string" }, | ||
time: { type: "string", format: "time" }, | ||
url: { type: "string", format: "uri" }, | ||
week: { type: "number", minimum: 1, maximum: 53 }, | ||
file: { type: "string", format:'uri' }, | ||
password: { type: "string" }, | ||
}; | ||
|
||
export default createJSONSchema; | ||
// export default createJSONSchema; |
Oops, something went wrong.
daa7438
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
save-my-form-frontend – ./
save-my-form-frontend-git-main-savemyform.vercel.app
save-my-form-frontend-savemyform.vercel.app
save-my-form-frontend.vercel.app