-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
23 changed files
with
611 additions
and
244 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
weatherfit_refactoring/src/Components/Atoms/Box/BoxStore.tsx
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,57 @@ | ||
import Image from 'next/image' | ||
import { MouseEventHandler } from 'react' | ||
|
||
export enum BoxStyle { | ||
BOX_WHITE = 'BOX_WHITE', | ||
BOX_YELLOW = 'BOX_YELLOW', | ||
BOX_BLUE = 'BOX_BLUE', | ||
BOX_IMAGE = 'BOX_IMAGE', | ||
} | ||
|
||
interface Props { | ||
title?: string | ||
boxStyle: BoxStyle | ||
style?: string | ||
onClickFunction?: MouseEventHandler<HTMLButtonElement> | undefined | ||
children?: React.ReactNode | ||
} | ||
//높이 조정도 필요하면 가져다 쓰세요 | ||
|
||
export default function ButtonStore({ | ||
boxStyle, | ||
children, | ||
onClickFunction, | ||
style, | ||
}: Props) { | ||
const selectButton = (): React.ReactNode => { | ||
switch (boxStyle) { | ||
case BoxStyle.BOX_WHITE: | ||
return ( | ||
<button | ||
className={`${style} bg-white border border-black rounded-2xl `}> | ||
{children} | ||
</button> | ||
) | ||
case BoxStyle.BOX_YELLOW: | ||
return ( | ||
<div className={`${style} bg-yellow-200 border-black rounded-2xl `}> | ||
{children} | ||
</div> | ||
) | ||
case BoxStyle.BOX_BLUE: | ||
return ( | ||
<div className={`${style} bg-blue-300 rounded-2xl`}>{children}</div> | ||
) | ||
case BoxStyle.BOX_IMAGE: | ||
return ( | ||
<div className="border rounded-2xl w-32 h-48 bg-stone-200 flex hover:bg-stone-300 relative flex-shrink-0"> | ||
{children} | ||
</div> | ||
) | ||
default: | ||
return null | ||
} | ||
} | ||
|
||
return <>{selectButton()}</> | ||
} |
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
55 changes: 0 additions & 55 deletions
55
weatherfit_refactoring/src/Components/Atoms/SelectCategory.tsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { create } from 'zustand' | ||
import { categories } from './CategoryList' | ||
|
||
interface State { | ||
content: string | ||
setContent: (content: string) => void | ||
hashTags: string[] | ||
setHashTags: (hashTags: string[]) => void | ||
selectedImages: File[] | ||
setSelectedImages: (selectedImages: File[]) => void | ||
selectedSubCategories: { [category: string]: string[] } | ||
setSelectedSubCategories: (category: string, subCategories: string[]) => void | ||
initialSubCategories: string[][] | ||
setInitialSubCategories: () => void | ||
} | ||
|
||
export const useStore = create<State>(set => ({ | ||
content: '', | ||
setContent: (content: string) => set(state => ({ ...state, content })), | ||
hashTags: [], | ||
setHashTags: (hashTags: string[]) => set(state => ({ ...state, hashTags })), | ||
selectedImages: [], | ||
setSelectedImages: (selectedImages: File[]) => | ||
set(state => ({ ...state, selectedImages })), | ||
// 하위 카테고리 관리 | ||
selectedSubCategories: {}, | ||
setSelectedSubCategories: (category: string, subCategories: string[]) => | ||
set(state => ({ | ||
...state, | ||
selectedSubCategories: { | ||
...state.selectedSubCategories, | ||
[category]: subCategories, | ||
}, | ||
})), | ||
initialSubCategories: [], | ||
setInitialSubCategories: () => | ||
set(state => ({ | ||
...state, | ||
initialSubCategories: Array(Object.entries(categories).length).fill([]), | ||
})), | ||
})) |
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,41 @@ | ||
'use client' | ||
|
||
import { | ||
ChangeEventHandler, | ||
FocusEventHandler, | ||
KeyboardEventHandler, | ||
LegacyRef, | ||
} from 'react' | ||
|
||
interface Props { | ||
placeholder: string | ||
value: string | ||
textAreaRef?: LegacyRef<HTMLTextAreaElement> | undefined | ||
onChangeFunction?: ChangeEventHandler<HTMLTextAreaElement> | ||
// onFocusFunction?: FocusEventHandler<HTMLTextAreaElement> | ||
onKeyDownFunction?: KeyboardEventHandler<HTMLTextAreaElement> | ||
} | ||
|
||
export default function TextArea({ | ||
textAreaRef, | ||
value, | ||
placeholder, | ||
onChangeFunction, | ||
// onFocusFunction, | ||
onKeyDownFunction, | ||
}: Props) { | ||
return ( | ||
<> | ||
<textarea | ||
className="w-full h-[125px] text-xs align-text-top border rounded-lg bg-white border-slave-500 p-2 font-NanumSquareRound resize-none mb-7 placeholder-gray-500" | ||
ref={textAreaRef} | ||
rows={6} | ||
value={value} | ||
placeholder={placeholder} | ||
onChange={onChangeFunction} | ||
// onFocus={onFocusFunction} | ||
onKeyDown={onKeyDownFunction} | ||
/> | ||
</> | ||
) | ||
} |
Oops, something went wrong.