Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"dependencies": {
"@ant-design/cssinjs": "^1.20.0",
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/react-fontawesome": "^0.2.2",
"@svgr/webpack": "^8.1.0",
"@t3-oss/env-nextjs": "^0.10.1",
"antd": "^5.18.0",
Expand Down
21 changes: 21 additions & 0 deletions src/app/mike/vote/container/VoteFormContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useRouter } from "next/navigation";
import { useState } from "react";
import { PageWithFormTemplate } from "~/components/Templates/PageWithForm/PageWithFormTemplate";

export const VoteFormContainer = () => {
const router = useRouter();
const [formData, setFormData] = useState<any>({});

const pagewithformTemplateProps: React.ComponentProps<
typeof PageWithFormTemplate
> = {
pageWithFormHeaderModuleProps: {
title: "Vote",
},
pageWithFormFormModuleProps: {
setFormData,
},
};

return <PageWithFormTemplate {...pagewithformTemplateProps} />;
};
8 changes: 8 additions & 0 deletions src/app/mike/vote/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"use client";
import { VoteFormContainer } from "./container/VoteFormContainer";

const VoteForm = () => {
return <VoteFormContainer />;
};

export default VoteForm;
12 changes: 6 additions & 6 deletions src/components/Atoms/HeaderAtom/HeaderAtom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ type Props = {

export const HeaderAtom = (props: Props) => {
return (
<div className="relative flex h-full w-full items-center justify-center bg-[#FFC96F]">
<div className='relative flex h-full w-full items-center justify-center bg-[#FFFFFF]'>
{/* Sample using custom svg */}
{props.onClickLeftIcon && (
<div
className="absolute left-0 z-[1] flex w-[50px] cursor-pointer items-center justify-center"
className='absolute left-0 z-[1] flex w-[50px] cursor-pointer items-center justify-center'
onClick={props.onClickLeftIcon}
>
<SVGAtom iconName="arrowLeft" width={20} height={20} color="black" />
<SVGAtom iconName='arrowLeft' width={20} height={20} color='black' />
</div>
)}

<div>{props.title}</div>
<div className='text-lg font-bold text-black'>{props.title}</div>

{/* Sample using Antd icon */}
{props.onClickRightIcon && (
<div
className="absolute right-0 z-[1] flex w-[50px] cursor-pointer items-center justify-center"
className='absolute right-0 z-[1] flex w-[50px] cursor-pointer items-center justify-center'
onClick={() => console.log("Antd icon clicked")}
>
<SettingOutlined className="!text-gray-header cursor-pointer text-[20px]" />
<SettingOutlined className='!text-gray-header cursor-pointer text-[20px]' />
</div>
)}
</div>
Expand Down
120 changes: 53 additions & 67 deletions src/components/Modules/PageWithForm/PageWithFormFormModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
ColorPicker,
Input,
message,
Upload,
} from "antd";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCamera } from "@fortawesome/free-solid-svg-icons";

const { RangePicker } = DatePicker;
const { TextArea } = Input;

Expand All @@ -30,88 +34,70 @@ export const PageWithFormFormModule = (props: Props) => {
return (
<Form
form={form}
labelCol={{ span: 6 }}
wrapperCol={{ span: 14 }}
labelCol={{ span: 24 }}
wrapperCol={{ span: 24 }}
onFieldsChange={(changedFields) => {
props.setFormData((prevData: any) =>
changedFields.reduce(
(acc, { name, value }) => ({ ...acc, [name[0]]: value }),
prevData,
),
prevData
)
);
}}
layout="horizontal"
style={{ maxWidth: 600 }}
layout='vertical'
style={{
maxWidth: 600,
padding: "20px 24px",
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
height: "100vh",
}}
onFinish={onFinish}
className='bg-white font-medium'
>
<Form.Item label="Radio" name="Radio">
<Radio.Group>
<Radio value="apple"> Apple </Radio>
<Radio value="pear"> Pear </Radio>
</Radio.Group>
<Form.Item label='Category' name='category'>
<Select placeholder='Birthday AD' style={{ height: "55px" }}>
<Select.Option value='demo'>Birthday AD</Select.Option>
</Select>
</Form.Item>
<Form.Item label="Input" name="Input">
<Input />
<Form.Item label='Vote Title' name='title'>
<Input placeholder='Title' className='h-14' />
</Form.Item>
<Form.Item label="Select" name="Select">
<Select>
<Select.Option value="demo">Demo</Select.Option>
</Select>
<Form.Item label='Image' name='image'>
<div className='flex h-44 w-full items-center justify-center rounded-lg bg-[#F5F5F5]'>
<Upload name='file' listType='picture-card' showUploadList={false}>
<FontAwesomeIcon
icon={faCamera}
className='text-xl text-gray-400'
/>
</Upload>
</div>
</Form.Item>
<Form.Item label="TreeSelect" name="TreeSelect">
<TreeSelect
treeData={[
{
title: "Light",
value: "light",
children: [{ title: "Bamboo", value: "bamboo" }],
},
]}
<Form.Item label='Description' name='description'>
<TextArea
placeholder='Please write down a description of the event'
rows={8}
/>
</Form.Item>
<Form.Item label="Cascader" name="Cascader">
<Cascader
options={[
{
value: "zhejiang",
label: "Zhejiang",
children: [
{
value: "hangzhou",
label: "Hangzhou",
},
],
},
]}
<Form.Item label='Start' name='date'>
<DatePicker
format='YYYY-MM-DD'
placeholder='2024-09-06'
className='h-14 w-full'
/>
</Form.Item>
<Form.Item label="DatePicker" name="DatePicker">
<DatePicker />
</Form.Item>
<Form.Item label="RangePicker" name="RangePicker">
<RangePicker />
</Form.Item>
<Form.Item label="InputNumber" name="InputNumber">
<InputNumber />
</Form.Item>
<Form.Item label="TextArea" name="TextArea">
<TextArea rows={4} />
</Form.Item>
<Form.Item label="Switch" name="Switch" valuePropName="checked">
<Switch />
</Form.Item>
<Form.Item label="Button" name="Button">
<Button>Button</Button>
</Form.Item>
<Form.Item label="Slider" name="Slider">
<Slider />
</Form.Item>
<Form.Item label="ColorPicker" name="ColorPicker">
<ColorPicker />
</Form.Item>
<div className="flex w-full items-center justify-center">
<Button type="primary" htmlType="submit">
Submit

{/* Spacer to push the button down */}
<div className='flex-grow'></div>

<div className='mb-4 flex w-full items-center justify-center'>
<Button
className='min-h-14 w-full bg-[#2F54EB]'
type='primary'
htmlType='submit'
>
<p className='text-xl'>Create Vote</p>
</Button>
</div>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import { HeaderAtom } from "~/components/Atoms/HeaderAtom/HeaderAtom";

type Props = {
title: string;
onClickLeftIcon: () => void;
onClickLeftIcon?: () => void;
};

export const PageWithFormHeaderModule = (props: Props) => {
return (
<HeaderAtom title={props.title} onClickLeftIcon={props.onClickLeftIcon} />
);
return <HeaderAtom title={props.title} />;
};
8 changes: 8 additions & 0 deletions src/components/Modules/Vote/VoteBannerModule.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const VoteBannerModule = () => {
return (
<div className='mb-4 bg-[#F0F5FF] p-2 p-5 text-left text-lg text-black'>
<span className='font-semibold text-blue-600'>10 FAO</span> will be
deducted when voting is generated (Amount : 9 FAO)
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PageWithFormHeaderModule } from "~/components/Modules/PageWithForm/PageWithFormHeaderModule";
import { PageWithFormFormModule } from "~/components/Modules/PageWithForm/PageWithFormFormModule";
import { VoteBannerModule } from "~/components/Modules/Vote/VoteBannerModule";
import { Layout } from "antd";
import { Content, Header } from "antd/es/layout/layout";

Expand All @@ -14,11 +15,13 @@ type Props = {

export const PageWithFormTemplate = (props: Props) => {
return (
<Layout style={{ height: "100%" }}>
<Layout style={{ height: "100%", backgroundColor: "#FFFFFF" }}>
<Header style={{ padding: 0, height: 50 }}>
<PageWithFormHeaderModule {...props.pageWithFormHeaderModuleProps} />
</Header>
<Content style={{ overflow: "auto" }}>
{/* Vote Info */}
<VoteBannerModule />
<PageWithFormFormModule {...props.pageWithFormFormModuleProps} />
</Content>
</Layout>
Expand Down