Skip to content

Commit

Permalink
#14 나의로그 기록있음/없음 화면 ui 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
nemobim committed Apr 3, 2024
1 parent 27bdc36 commit 43bcde1
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 162 deletions.
48 changes: 48 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@types/js-cookie": "^3.0.6",
"axios": "^1.6.8",
"js-cookie": "^3.0.5",
Expand Down
9 changes: 9 additions & 0 deletions src/apis/myLogApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import axios from 'axios'
import { useQuery } from 'react-query'

/**내가 등록한 책 목록 조회 */
export const getMyBookList = async () => {
return useQuery(['MyBookList'], async () => {
const { data } = await axios.get(`/api/books`)
return data
})
}

/* 나의로그 페이지 - 등록한 책 목록 */
export const onBookList = async () => {
Expand Down
23 changes: 23 additions & 0 deletions src/apis/userApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios'
import { useMutation } from 'react-query'

/**회원 로그인 */
export const onLogin = async (data: { email: string; password: string }) => {
Expand All @@ -15,3 +16,25 @@ export const onJoin = async (data: FormData) => {
})
return response
}

/**회원 정보 (닉네임, 프로필이미지) 수정 */
export const useModifyUser = async () => {
return useMutation(
async (data: FormData) => {
const response = await axios.patch(`/api/doctor`, data, {
headers: {
'Content-Type': 'multipart/form-data',
},
})
return response
},
{
onSuccess: () => {},
onError: () => {
alert('회원정보 수정에 실패했습니다. 잠시후 다시 시도해주세요.')
},
},
)
}

/**비밀번호 변경 */
30 changes: 30 additions & 0 deletions src/components/mylog/EmptyMylog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { css } from '@emotion/react'
import { colors, flexCenter } from '../../styles/theme'

const EmptyMylog = () => {
return (
<div css={container}>
<div className="image">이미지</div>
</div>
)
}

export default EmptyMylog

const container = css`
height: calc(100vh - 10rem);
${flexCenter}
flex-direction: column;
.image {
width: 120px;
height: 120px;
background-color: #c5c5c5;
margin-bottom: 8rem;
}
button {
font-weight: 700;
color: ${colors.main1};
}
`
79 changes: 0 additions & 79 deletions src/components/mylog/MyLogSearch.tsx

This file was deleted.

63 changes: 63 additions & 0 deletions src/elements/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { css } from '@emotion/react'
import { faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { useState } from 'react'
import { calcRem, flexCenter } from '../styles/theme'

interface ISearchBarProps {
/**검색어 placeholder */
placeHolder: string
}

/**검색바 */
const SearchBar = ({ placeHolder }: ISearchBarProps) => {
const [searchKeyWord, setSearchKeyWord] = useState('')

const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearchKeyWord(e.target.value)
}

return (
<div css={search}>
<div css={searchContainer}>
<input type="text" placeholder={placeHolder} onChange={handleChange} />
<button>
<FontAwesomeIcon icon={faMagnifyingGlass} size="lg" color="#836565" />
</button>
</div>
</div>
)
}

export default SearchBar

const search = css`
margin-top: 4rem;
width: 100%;
max-width: 26rem;
left: 50%;
transform: translateX(-50%);
position: fixed;
top: 0;
background-color: #ffffff;
${flexCenter}
flex-direction: row;
height: ${calcRem(50)};
z-index: 10;
`

const searchContainer = css`
display: flex;
align-items: center;
width: ${calcRem(253)};
height: ${calcRem(32)};
border: 1px solid #836565;
input {
font-weight: 500;
width: 100%;
background: transparent;
padding: ${calcRem(5)} ${calcRem(10)};
border: none;
}
`
5 changes: 3 additions & 2 deletions src/elements/Topbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css } from '@emotion/react'
import { faChevronLeft } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { useNavigate } from 'react-router-dom'
import back from '../assets/images/뒤로가기버튼.png'

const Topbar = () => {
const navigate = useNavigate()
Expand All @@ -13,7 +14,7 @@ const Topbar = () => {
return (
<div css={topbar}>
<button onClick={handleClick} css={backBtn}>
<img src={back} alt="Back" />
<FontAwesomeIcon icon={faChevronLeft} size="xl" color="#836565" />
</button>
<h1 css={title}>ReadingLog</h1>
</div>
Expand Down
Loading

0 comments on commit 43bcde1

Please sign in to comment.