-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from School-of-Company/feature/program
🔀 프로그램 폼 테이블 제작
- Loading branch information
Showing
12 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
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,12 @@ | ||
import React from 'react'; | ||
import { Program } from '@/views/program'; | ||
|
||
const Page = ({ params }: { params: { expo_id: string } }) => { | ||
return ( | ||
<div> | ||
<Program params={params} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Page; |
This file was deleted.
Oops, something went wrong.
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
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 @@ | ||
export { default as ProgramNavigation } from './ui/ProgramNavigation'; |
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,34 @@ | ||
import React from 'react'; | ||
|
||
interface ProgramNavigationProps { | ||
state: string; | ||
setState: React.Dispatch<React.SetStateAction<string>>; | ||
} | ||
|
||
const ProgramNavigation: React.FC<ProgramNavigationProps> = ({ | ||
state, | ||
setState, | ||
}) => { | ||
return ( | ||
<div className="flex justify-center gap-[18px]"> | ||
<button | ||
className={`text-h2 ${state === 'standard' ? 'text-black' : 'text-gray-500'}`} | ||
onClick={() => { | ||
setState('standard'); | ||
}} | ||
> | ||
일반 프로그램 | ||
</button> | ||
<button | ||
className={`text-h2 ${state === 'training' ? 'text-black' : 'text-gray-500'}`} | ||
onClick={() => { | ||
setState('training'); | ||
}} | ||
> | ||
연수 프로그램 | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgramNavigation; |
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
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
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 @@ | ||
export { default as Program } from './ui/Program'; |
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,14 @@ | ||
import React from 'react'; | ||
import { Header } from '@/widgets/layout'; | ||
import { ProgramForm } from '@/widgets/program'; | ||
|
||
const Program = ({ params }: { params: { expo_id: string } }) => { | ||
return ( | ||
<div className="flex h-screen flex-col gap-[30px] mobile:gap-5"> | ||
<Header /> | ||
<ProgramForm params={params} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Program; |
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
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 @@ | ||
export { default as ProgramForm } from './ui/ProgramForm'; |
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,60 @@ | ||
'use client'; | ||
|
||
import axios from 'axios'; | ||
import React, { useEffect, useState } from 'react'; | ||
import { ProgramNavigation } from '@/entities/program'; | ||
import { fileActions } from '@/shared/model/footerActions'; | ||
import { TableForm } from '@/shared/ui/Table'; | ||
|
||
interface Program { | ||
id: number; | ||
title: string; | ||
startedAt: string; | ||
endedAt: string; | ||
category: string; | ||
} | ||
|
||
const ProgramForm = ({ params }: { params: { expo_id: string } }) => { | ||
const requestPrintCategories = [ | ||
'번호', | ||
'프로그램', | ||
'시작시간', | ||
'종료시간', | ||
'상태', | ||
]; | ||
const [expoData, setExpoData] = useState<Program[]>([]); | ||
const [navigation, setnavigation] = useState<string>('standard'); | ||
|
||
useEffect(() => { | ||
const fetchExpoData = async () => { | ||
try { | ||
const endpoint = | ||
navigation === 'training' | ||
? `/api/training/program/${params.expo_id}` | ||
: `/api/standard/program/${params.expo_id}`; | ||
|
||
const response = await axios.get(endpoint); | ||
setExpoData(response.data); | ||
} catch (error) { | ||
console.error('Error fetching expo data:', error); | ||
} | ||
}; | ||
fetchExpoData(); | ||
}, [params.expo_id, navigation]); | ||
|
||
return ( | ||
<div className="mx-auto w-full max-w-[1200px] space-y-[46px] px-5"> | ||
<ProgramNavigation state={navigation} setState={setnavigation} /> | ||
<TableForm | ||
categories={requestPrintCategories} | ||
data={expoData} | ||
maxHeight="414px" | ||
footerType="default" | ||
text="프로그램 수" | ||
actions={fileActions} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgramForm; |