-
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.
- Loading branch information
1 parent
6e22684
commit b99615f
Showing
10 changed files
with
153 additions
and
141 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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import { secureInstance } from './instance'; | ||
|
||
export interface DictionarySeafood { | ||
seafoodId: number; | ||
koreanName: string; | ||
englishName: string; | ||
name: string; | ||
description: string; | ||
insDt: string; | ||
count: number; | ||
} | ||
|
||
export const getSeafoodMy = async (): Promise<DictionarySeafood[]> => { | ||
const response = await secureInstance.get('/seafoods/my'); | ||
export const getSeafoods = async (): Promise<DictionarySeafood[]> => { | ||
const response = await secureInstance.get('/seafoods'); | ||
return response.data; | ||
}; |
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
import { instance } from './instance'; | ||
|
||
const getTest = async (): Promise<boolean> => { | ||
return await instance.get(`/test`); | ||
}; | ||
|
||
const getDb = async (): Promise<boolean> => { | ||
return await instance.get(`/db`); | ||
import { secureInstance } from './instance'; | ||
|
||
export interface SeafoodCollected { | ||
seafoodId: number; | ||
koreanName: string; | ||
englishName: string; | ||
count: number; | ||
} | ||
|
||
export const getSeafoodCollected = async (): Promise<SeafoodCollected[]> => { | ||
const response = await secureInstance.get('/seafoods/collected'); | ||
return response.data; | ||
}; | ||
|
||
const getConnect = async (): Promise<string> => { | ||
return await instance.get(`/connect`); | ||
}; | ||
|
||
export { getTest, getDb, getConnect }; |
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,8 +1,79 @@ | ||
interface Props { | ||
children: React.ReactNode; | ||
label: string; | ||
import { useState } from 'react'; | ||
|
||
interface DropdownItem { | ||
displayName: string; | ||
value: number | null; | ||
} | ||
|
||
interface DropdownProps { | ||
value: number | null; | ||
items: DropdownItem[]; | ||
onChange: (value: number) => void; | ||
placeholder?: string; | ||
} | ||
|
||
export const Dropdown = ({ children, label }: Props) => { | ||
return <></>; | ||
export const Dropdown = ({ | ||
value, | ||
items, | ||
onChange, | ||
placeholder, | ||
}: DropdownProps) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
const selectedItem = items.find((item) => item.value === value); | ||
|
||
return ( | ||
<div className="relative w-24"> | ||
<button | ||
onClick={() => setIsOpen(!isOpen)} | ||
className="h-10 w-full rounded-md border border-gray-300 bg-white px-4 py-2 text-left shadow-sm focus:outline-none" | ||
> | ||
{selectedItem ? ( | ||
<span>{selectedItem.displayName}</span> | ||
) : ( | ||
<span className="text-gray-400">{placeholder}</span> | ||
)} | ||
<span className="float-right"> | ||
<svg | ||
className={`size-4 transition-transform ${ | ||
isOpen ? 'rotate-180' : 'rotate-0' | ||
}`} | ||
fill="none" | ||
stroke="currentColor" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M19 9l-7 7-7-7" | ||
/> | ||
</svg> | ||
</span> | ||
</button> | ||
{isOpen && ( | ||
<ul className="hide-scroll absolute left-0 z-10 mt-1 h-40 max-h-60 w-full overflow-auto rounded-md border border-gray-300 bg-white shadow-lg"> | ||
{items.map((item, index) => ( | ||
<li | ||
key={index} | ||
onClick={() => { | ||
if (item.value) { | ||
onChange(item.value); | ||
setIsOpen(false); | ||
} | ||
}} | ||
className={`cursor-pointer px-4 py-2 hover:bg-gray-100 ${ | ||
value === item.value ? 'bg-gray-200' : '' | ||
}`} | ||
> | ||
{item.displayName} | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
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 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
Oops, something went wrong.