From 0048bf34ba1a5b68f91e1476b3aa1e4cbebbba74 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Fri, 17 Nov 2023 22:41:41 +0900 Subject: [PATCH 1/9] [feat] Add Donation-Amount Data-List --- .../src/constants/donationAmount.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 view/next-project/src/constants/donationAmount.ts diff --git a/view/next-project/src/constants/donationAmount.ts b/view/next-project/src/constants/donationAmount.ts new file mode 100644 index 000000000..c4875d88d --- /dev/null +++ b/view/next-project/src/constants/donationAmount.ts @@ -0,0 +1,18 @@ +export const DONATION_AMOUNT = [ + { + id: 1, + name: '1000' + }, + { + id: 2, + name: '2000' + }, + { + id: 3, + name: '5000' + }, + { + id: 4, + name: '10000' + }, +]; From 04572cd2b8c9bc1cecbb3b074551239891e09721 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Fri, 17 Nov 2023 22:42:53 +0900 Subject: [PATCH 2/9] [feat] Add datalist --- .../src/components/common/Input/Input.tsx | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/view/next-project/src/components/common/Input/Input.tsx b/view/next-project/src/components/common/Input/Input.tsx index 00860de0a..81f0dea33 100644 --- a/view/next-project/src/components/common/Input/Input.tsx +++ b/view/next-project/src/components/common/Input/Input.tsx @@ -11,6 +11,9 @@ interface Props { onChange?: (e: React.ChangeEvent) => void; children?: React.ReactNode; type?: string; + datalist?: { id: number; name: string }[]; + listKey?: string; + enableDatalist?: boolean; } function Input(props: Props): JSX.Element { @@ -18,16 +21,27 @@ function Input(props: Props): JSX.Element { 'rounded-full border border-primary-1 py-2 px-4' + (props.className ? ` ${props.className}` : ''); return ( - - {props.children} - +
+ + {props.children} + + {props.enableDatalist && ( + + {props.datalist?.map((option) => ( + + )} +
+ ); } From 2c34d4a98ce061c3ca4777416ff7915584c12933 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Fri, 17 Nov 2023 22:45:50 +0900 Subject: [PATCH 3/9] [feat] Add attribute to AddModal --- .../src/components/fund_information/AddModal.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/view/next-project/src/components/fund_information/AddModal.tsx b/view/next-project/src/components/fund_information/AddModal.tsx index fbe14c544..574dcd323 100644 --- a/view/next-project/src/components/fund_information/AddModal.tsx +++ b/view/next-project/src/components/fund_information/AddModal.tsx @@ -6,6 +6,7 @@ import { Modal, CloseButton, Input, Select, PrimaryButton } from '../common'; import { userAtom } from '@/store/atoms'; import { post } from '@api/fundInformations'; import { BUREAUS } from '@constants/bureaus'; +import { DONATION_AMOUNT } from "@constants/donationAmount"; import { Department, FundInformation, Teacher, User } from '@type/common'; interface ModalProps { @@ -53,9 +54,9 @@ const OpenAddModal: FC = (props) => { const handler = (input: string) => - (e: React.ChangeEvent | React.ChangeEvent) => { - setFormData({ ...formData, [input]: e.target.value }); - }; + (e: React.ChangeEvent | React.ChangeEvent) => { + setFormData({ ...formData, [input]: e.target.value }); + }; const handleDepartmentID = (e: React.ChangeEvent) => { setDepartmentID(Number(e.target.value)); @@ -132,7 +133,14 @@ const OpenAddModal: FC = (props) => {

金額

- +

備考

From 9ea1599d899b7fe0ab79c71f7d09898a0ff70169 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Fri, 17 Nov 2023 22:46:12 +0900 Subject: [PATCH 4/9] [feat] Add attribute to EditModal --- .../components/fund_information/EditModal.tsx | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/view/next-project/src/components/fund_information/EditModal.tsx b/view/next-project/src/components/fund_information/EditModal.tsx index 157c69fb6..40340705c 100644 --- a/view/next-project/src/components/fund_information/EditModal.tsx +++ b/view/next-project/src/components/fund_information/EditModal.tsx @@ -4,6 +4,7 @@ import { Dispatch, SetStateAction, useEffect, useState, useMemo } from 'react'; import { Modal, Input, Select, CloseButton, PrimaryButton } from '../common'; import { put } from '@api/fundInformations'; import { BUREAUS } from '@constants/bureaus'; +import { DONATION_AMOUNT } from "@constants/donationAmount"; import { FundInformation, Teacher, User, Department } from '@type/common'; interface ModalProps { @@ -39,14 +40,14 @@ export default function EditModal(props: ModalProps) { const handler = (input: string) => - ( - e: - | React.ChangeEvent - | React.ChangeEvent - | React.ChangeEvent, - ) => { - setFormData({ ...formData, [input]: e.target.value }); - }; + ( + e: + | React.ChangeEvent + | React.ChangeEvent + | React.ChangeEvent, + ) => { + setFormData({ ...formData, [input]: e.target.value }); + }; const submitFundInformation = async (data: FundInformation) => { const submitFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + data.id; @@ -140,7 +141,14 @@ export default function EditModal(props: ModalProps) {

金額

- +

備考

From 02bfca54341a44e32120fc650c9b4cce5c6ce34f Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Fri, 17 Nov 2023 14:21:15 +0000 Subject: [PATCH 5/9] formatted by workflow --- .../src/components/common/Input/Input.tsx | 1 - .../components/fund_information/AddModal.tsx | 8 ++++---- .../components/fund_information/EditModal.tsx | 18 +++++++++--------- .../src/constants/donationAmount.ts | 8 ++++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/view/next-project/src/components/common/Input/Input.tsx b/view/next-project/src/components/common/Input/Input.tsx index 81f0dea33..32cddbc94 100644 --- a/view/next-project/src/components/common/Input/Input.tsx +++ b/view/next-project/src/components/common/Input/Input.tsx @@ -41,7 +41,6 @@ function Input(props: Props): JSX.Element { )}
- ); } diff --git a/view/next-project/src/components/fund_information/AddModal.tsx b/view/next-project/src/components/fund_information/AddModal.tsx index 574dcd323..4db77e873 100644 --- a/view/next-project/src/components/fund_information/AddModal.tsx +++ b/view/next-project/src/components/fund_information/AddModal.tsx @@ -6,7 +6,7 @@ import { Modal, CloseButton, Input, Select, PrimaryButton } from '../common'; import { userAtom } from '@/store/atoms'; import { post } from '@api/fundInformations'; import { BUREAUS } from '@constants/bureaus'; -import { DONATION_AMOUNT } from "@constants/donationAmount"; +import { DONATION_AMOUNT } from '@constants/donationAmount'; import { Department, FundInformation, Teacher, User } from '@type/common'; interface ModalProps { @@ -54,9 +54,9 @@ const OpenAddModal: FC = (props) => { const handler = (input: string) => - (e: React.ChangeEvent | React.ChangeEvent) => { - setFormData({ ...formData, [input]: e.target.value }); - }; + (e: React.ChangeEvent | React.ChangeEvent) => { + setFormData({ ...formData, [input]: e.target.value }); + }; const handleDepartmentID = (e: React.ChangeEvent) => { setDepartmentID(Number(e.target.value)); diff --git a/view/next-project/src/components/fund_information/EditModal.tsx b/view/next-project/src/components/fund_information/EditModal.tsx index 40340705c..397683d7c 100644 --- a/view/next-project/src/components/fund_information/EditModal.tsx +++ b/view/next-project/src/components/fund_information/EditModal.tsx @@ -4,7 +4,7 @@ import { Dispatch, SetStateAction, useEffect, useState, useMemo } from 'react'; import { Modal, Input, Select, CloseButton, PrimaryButton } from '../common'; import { put } from '@api/fundInformations'; import { BUREAUS } from '@constants/bureaus'; -import { DONATION_AMOUNT } from "@constants/donationAmount"; +import { DONATION_AMOUNT } from '@constants/donationAmount'; import { FundInformation, Teacher, User, Department } from '@type/common'; interface ModalProps { @@ -40,14 +40,14 @@ export default function EditModal(props: ModalProps) { const handler = (input: string) => - ( - e: - | React.ChangeEvent - | React.ChangeEvent - | React.ChangeEvent, - ) => { - setFormData({ ...formData, [input]: e.target.value }); - }; + ( + e: + | React.ChangeEvent + | React.ChangeEvent + | React.ChangeEvent, + ) => { + setFormData({ ...formData, [input]: e.target.value }); + }; const submitFundInformation = async (data: FundInformation) => { const submitFundInformationURL = process.env.CSR_API_URI + '/fund_informations/' + data.id; diff --git a/view/next-project/src/constants/donationAmount.ts b/view/next-project/src/constants/donationAmount.ts index c4875d88d..e1c24180e 100644 --- a/view/next-project/src/constants/donationAmount.ts +++ b/view/next-project/src/constants/donationAmount.ts @@ -1,18 +1,18 @@ export const DONATION_AMOUNT = [ { id: 1, - name: '1000' + name: '1000', }, { id: 2, - name: '2000' + name: '2000', }, { id: 3, - name: '5000' + name: '5000', }, { id: 4, - name: '10000' + name: '10000', }, ]; From 6fec28d53ff82b88d27fa93e25837dd96cb5ebba Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Mon, 20 Nov 2023 19:54:18 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[fix]=20=E4=B8=80=E9=83=A8=E3=81=AEprops?= =?UTF-8?q?=E3=82=92datalist=E3=81=AB=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/common/Input/Input.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/view/next-project/src/components/common/Input/Input.tsx b/view/next-project/src/components/common/Input/Input.tsx index 32cddbc94..daf1b7631 100644 --- a/view/next-project/src/components/common/Input/Input.tsx +++ b/view/next-project/src/components/common/Input/Input.tsx @@ -11,9 +11,10 @@ interface Props { onChange?: (e: React.ChangeEvent) => void; children?: React.ReactNode; type?: string; - datalist?: { id: number; name: string }[]; - listKey?: string; - enableDatalist?: boolean; + datalist?: { + key: string; + data: { id:number; name: string}[]; + } } function Input(props: Props): JSX.Element { @@ -29,16 +30,16 @@ function Input(props: Props): JSX.Element { value={props.value} onChange={props.onChange} type={props.type} - list={props.enableDatalist ? props.listKey : undefined} + list={props.datalist?.key} > {props.children} - {props.enableDatalist && ( - - {props.datalist?.map((option) => ( - + {props.datalist?.key && props.datalist?.data && ( + + {props.datalist.data.map((option) => ( + )} ); From 2d6851e3861001f9c87b0f9e03178003eb227235 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Mon, 20 Nov 2023 19:54:55 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[fix]=20=E7=B5=B1=E5=90=88=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=9Fprops=E3=81=8B=E3=82=89=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=80=A4=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/fund_information/AddModal.tsx | 7 ++++--- .../src/components/fund_information/EditModal.tsx | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/view/next-project/src/components/fund_information/AddModal.tsx b/view/next-project/src/components/fund_information/AddModal.tsx index 4db77e873..0cb8b81bf 100644 --- a/view/next-project/src/components/fund_information/AddModal.tsx +++ b/view/next-project/src/components/fund_information/AddModal.tsx @@ -137,9 +137,10 @@ const OpenAddModal: FC = (props) => { className='w-full' value={formData.price} onChange={handler('price')} - datalist={DONATION_AMOUNT} - listKey='amoutOptions' - enableDatalist={true} + datalist={{ + key: "amoutOptions", + data: DONATION_AMOUNT, + }} />

備考

diff --git a/view/next-project/src/components/fund_information/EditModal.tsx b/view/next-project/src/components/fund_information/EditModal.tsx index 397683d7c..301fd848d 100644 --- a/view/next-project/src/components/fund_information/EditModal.tsx +++ b/view/next-project/src/components/fund_information/EditModal.tsx @@ -145,9 +145,10 @@ export default function EditModal(props: ModalProps) { className='w-full' value={formData.price} onChange={handler('price')} - datalist={DONATION_AMOUNT} - listKey='amoutOptions' - enableDatalist={true} + datalist={{ + key: "amoutOptions", + data: DONATION_AMOUNT, + }} />

備考

From 4e8efc89d7c8af94628ba5a465fd7909313c53c3 Mon Sep 17 00:00:00 2001 From: TkymHrt Date: Mon, 20 Nov 2023 10:56:03 +0000 Subject: [PATCH 8/9] formatted by workflow --- .../src/components/common/Input/Input.tsx | 12 ++++++------ .../src/components/fund_information/AddModal.tsx | 2 +- .../src/components/fund_information/EditModal.tsx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/view/next-project/src/components/common/Input/Input.tsx b/view/next-project/src/components/common/Input/Input.tsx index daf1b7631..2bc392043 100644 --- a/view/next-project/src/components/common/Input/Input.tsx +++ b/view/next-project/src/components/common/Input/Input.tsx @@ -13,8 +13,8 @@ interface Props { type?: string; datalist?: { key: string; - data: { id:number; name: string}[]; - } + data: { id: number; name: string }[]; + }; } function Input(props: Props): JSX.Element { @@ -36,10 +36,10 @@ function Input(props: Props): JSX.Element { {props.datalist?.key && props.datalist?.data && ( - {props.datalist.data.map((option) => ( - + {props.datalist.data.map((option) => ( +