-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feauture/diary-edit-weather' of https://github.com/Dong…
…grina/Frontend into feature/story
- Loading branch information
Showing
19 changed files
with
190 additions
and
43 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,34 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], | ||
parser: '@typescript-eslint/parser', // ESLint 파서를 지정합니다. | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, // JSX를 파싱할 수 있습니다. | ||
}, | ||
ecmaVersion: 12, // Modern ECMAScript를 파싱할 수 있습니다. | ||
sourceType: 'module', // import, export를 사용할 수 있습니다. | ||
}, | ||
plugins: ['@typescript-eslint', 'prettier'], | ||
|
||
rules: { | ||
// ESLint 규칙을 지정합니다. extends에서 지정된 규칙을 덮어 쓸수도 있습니다. | ||
'react/react-in-jsx-scope': 'off', | ||
'react/prop-types': 'off', | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
endOfLine: 'auto', | ||
}, | ||
], | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', // 현재 사용하고 있는 react 버전을 eslint-plugin-react가 자동으로 감지합니다. | ||
}, | ||
}, | ||
}; |
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
Empty file.
5 changes: 5 additions & 0 deletions
5
...ary-edit-memo/diary-edit-memo.module.scss → ...ies/edit/memo/diary-edit-memo.module.scss
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,3 +1,8 @@ | ||
.wrapper { | ||
border-top: 5px solid #f5f5f5; | ||
padding: 0 24px; | ||
} | ||
|
||
.memo { | ||
font-size: 14px; | ||
display: block; | ||
|
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,18 @@ | ||
import React from 'react'; | ||
import styles from './diary-edit-memo.module.scss'; | ||
import { useFormContext } from 'react-hook-form'; | ||
|
||
export default function MemoItem() { | ||
const { register } = useFormContext<{ memo: string }>(); | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
<textarea | ||
{...register('memo')} | ||
className={styles.memo} | ||
id="content.memo" | ||
placeholder={`메모\n어떤 일정인지 자세하게 기록하실 수 있어요!`} | ||
/> | ||
</div> | ||
); | ||
} |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
components/diaries/edit/diary-edit-pets.tsx → ...diaries/edit/pets/diary-edit-pet-list.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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
components/diaries/jihye/diary-edit-weather/diary-edit-weather.module.scss
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,22 @@ | ||
.weatherContainer { | ||
padding: 0 24px; | ||
margin-bottom: 30px; | ||
.label { | ||
padding-left: 10px; | ||
border-left: 2px solid var(--text-color-gray); | ||
font-size: 14px; | ||
margin-bottom: 12px; | ||
} | ||
|
||
.weatherIcons { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
button { | ||
height: 40px; | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
} | ||
} |
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,43 @@ | ||
import React, { useState } from 'react'; | ||
import styles from './diary-edit-weather.module.scss'; | ||
import { WEATHER_TYPES } from '@/lib/constants/diaries-constants'; | ||
import Image from 'next/image'; | ||
import { UseFormSetValue } from 'react-hook-form'; | ||
import { DiaryData } from '../../diary-create/diary-create'; | ||
|
||
type WeatherType = (typeof WEATHER_TYPES)[number]; | ||
|
||
interface WeatherItemProps { | ||
setValue: UseFormSetValue<DiaryData>; | ||
} | ||
|
||
export default function WeatherItem({ setValue }: WeatherItemProps) { | ||
const [selectedWeather, setSelectedWeather] = useState<string | null>(null); | ||
|
||
const handleClick = (weather: WeatherType) => { | ||
setSelectedWeather(weather.id); | ||
setValue('weather', weather.id); | ||
}; | ||
return ( | ||
<div className={styles.weatherContainer}> | ||
<div className={styles.label}>날씨</div> | ||
<div className={styles.weatherIcons}> | ||
{WEATHER_TYPES.map((weather) => ( | ||
<button | ||
key={weather.id} | ||
type="button" | ||
onClick={() => handleClick(weather)} | ||
className={selectedWeather === weather.id ? styles.selected : ''} | ||
> | ||
<Image | ||
src={selectedWeather === weather.id ? weather.selectedIcon : weather.icon} | ||
alt={weather.label} | ||
width={40} | ||
height={40} | ||
/> | ||
</button> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
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,24 +1,39 @@ | ||
import React from 'react'; | ||
import DiaryEditHeader from '@/components/diaries/edit/diary-edit-header'; | ||
import DiaryEditPets from '@/components/diaries/edit/pets/diary-edit-pets'; | ||
import { useFetchDiaryById } from '@/hooks/queries/diary/queries'; | ||
import useRouterId from '@/hooks/utils/use-router-id'; | ||
import { FormProvider, useForm } from 'react-hook-form'; | ||
import Suspensive from '@/components/suspensive/suspensive'; | ||
import MemoItem from '@/components/diaries/edit/memo'; | ||
|
||
export default function DiaryEditPage() { | ||
const diaryId = +useRouterId('diaryId')!; | ||
const diaryQuery = useFetchDiaryById(diaryId); | ||
const methods = useForm<{ [key: string]: string }>(); | ||
const methods = useForm<{ | ||
pets: string | string[]; | ||
memo: string; | ||
}>(); | ||
|
||
if (diaryQuery.isLoading) return ''; | ||
|
||
const onSubmit = (data: any) => { | ||
console.log(data); | ||
}; | ||
|
||
console.log(diaryQuery.data); | ||
|
||
return ( | ||
<main style={{ paddingTop: '54px' }}> | ||
<Suspensive isLoading={diaryQuery.isLoading}> | ||
<form onSubmit={methods.handleSubmit(onSubmit)}> | ||
<FormProvider {...methods}> | ||
<DiaryEditHeader /> | ||
<Suspensive isLoading={diaryQuery.isLoading}> | ||
<DiaryEditPets /> | ||
</Suspensive> | ||
<MemoItem /> | ||
</FormProvider> | ||
</Suspensive> | ||
|
||
<button type="submit">check</button> | ||
</form> | ||
</main> | ||
); | ||
} |
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