-
Notifications
You must be signed in to change notification settings - Fork 0
공지사항 ui, api 연결 (#isuue 276) #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
664778d
feat: 공지사항 ui, api 연결 (검색기능 제외-아직 백엔드 구현 안됨)
YouD0313 bfa66e0
refactor: 리뷰반영
YouD0313 829c70a
feat: 공지사항 페이지네이션
YouD0313 18490c3
refactor: 리뷰반영
YouD0313 71068ce
refactor: 페이지네이션 공통 컴포넌트로 수정
YouD0313 e9a730f
feat: 공지사항 detail id 없을때 처리 연결 - 백엔드 컨텐트 없을때 throw error 수정- 목록버튼 , 컨…
YouD0313 c9cffa0
refactor: 공지사항 id 없을 때 문구수정, 개행 받을 수 있게 수정
YouD0313 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,7 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const ContentBorder = styled.div` | ||
| width: 100%; | ||
| height: 0.5px; | ||
| background: ${({ theme }) => theme.color.placeholder}; | ||
| `; |
This file contains hidden or 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,5 @@ | ||
| import * as S from './ContentBorder.styled'; | ||
|
|
||
| export default function ContentBorder() { | ||
| return <S.ContentBorder></S.ContentBorder>; | ||
| } |
File renamed without changes.
This file contains hidden or 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 hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
src/components/customerService/notice/NoticeList.styled.ts
This file contains hidden or 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,27 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const Container = styled.nav` | ||
| width: 100%; | ||
| `; | ||
|
|
||
| export const Wrapper = styled.button` | ||
| width: 100%; | ||
| padding: 1rem 1.5rem; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
|
|
||
| &:hover { | ||
| background: ${({ theme }) => theme.color.lightgrey}; | ||
| } | ||
| `; | ||
|
|
||
| export const Title = styled.span` | ||
| font-size: 1.2rem; | ||
| font-weight: 700; | ||
| `; | ||
|
|
||
| export const NoticeDate = styled.span` | ||
| font-size: 1.1rem; | ||
| color: ${({ theme }) => theme.color.placeholder}; | ||
| `; | ||
This file contains hidden or 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 type { NoticeList as TNoticeList } from '../../../models/customerService'; | ||
| import { formatDate } from '../../../util/format'; | ||
| import * as S from './NoticeList.styled'; | ||
|
|
||
| interface NoticeProps { | ||
| notice: TNoticeList; | ||
| } | ||
|
|
||
| export default function NoticeList({ notice }: NoticeProps) { | ||
| return ( | ||
| <S.Container> | ||
| <S.Wrapper type='button' aria-label='공지사항 상세보기'> | ||
| <S.Title>{notice.title}</S.Title> | ||
| <S.NoticeDate>{formatDate(notice.createdAt)}</S.NoticeDate> | ||
| </S.Wrapper> | ||
| </S.Container> | ||
| ); | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/components/customerService/noticeDetail/NoticeDetailBundle.styled.ts
This file contains hidden or 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,11 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const SpinnerWrapper = styled.div` | ||
| height: 60vh; | ||
| `; | ||
|
|
||
| export const Container = styled.section` | ||
| width: 75%; | ||
| margin: 0 auto; | ||
| margin-bottom: 2rem; | ||
| `; |
63 changes: 63 additions & 0 deletions
63
src/components/customerService/noticeDetail/NoticeDetailBundle.tsx
This file contains hidden or 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,63 @@ | ||
| import { useLocation, useParams } from 'react-router-dom'; | ||
| import { useGetNoticeDetail } from '../../../hooks/useGetNoticeDetail'; | ||
| import * as S from './NoticeDetailBundle.styled'; | ||
| import NoticeDetailBottom from './bottom/NoticeDetailBottom'; | ||
| import NoticeDetailContent from './content/NoticeDetailContent'; | ||
| import NoticeDetailHeader from './header/NoticeDetailHeader'; | ||
| import Spinner from '../../mypage/Spinner'; | ||
| import ListButton from './bottom/button/ListButton'; | ||
|
|
||
| export default function NoticeDetailBundle() { | ||
| const location = useLocation(); | ||
| const { noticeId } = useParams(); | ||
| const id = noticeId || String(location.state.id); | ||
|
|
||
| const { noticeDetail: noticeDetailData, isLoading } = useGetNoticeDetail(id); | ||
|
|
||
| if (isLoading) { | ||
| return ( | ||
| <S.SpinnerWrapper> | ||
| <Spinner /> | ||
| </S.SpinnerWrapper> | ||
| ); | ||
| } | ||
|
|
||
| if (!noticeDetailData) { | ||
| return ( | ||
| <S.Container> | ||
| <NoticeDetailContent | ||
| id={0} | ||
| title='공지사항이 없습니다.' | ||
| content='목록으로 돌아가세요.' | ||
| createdAt='' | ||
| viewCount={0} | ||
| /> | ||
| <ListButton /> | ||
| </S.Container> | ||
| ); | ||
| } | ||
|
|
||
| const { | ||
| id: detailId, | ||
| title, | ||
| content, | ||
| createdAt, | ||
| viewCount, | ||
| prev, | ||
| next, | ||
| } = noticeDetailData; | ||
|
|
||
| return ( | ||
| <S.Container> | ||
| <NoticeDetailHeader /> | ||
| <NoticeDetailContent | ||
| id={detailId} | ||
| title={title} | ||
| content={content} | ||
| createdAt={createdAt} | ||
| viewCount={viewCount} | ||
| /> | ||
| <NoticeDetailBottom prev={prev} next={next} /> | ||
| </S.Container> | ||
| ); | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/components/customerService/noticeDetail/bottom/NoticeDetailBottom.styled.ts
This file contains hidden or 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,8 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const Container = styled.nav``; | ||
|
|
||
| export const NotOtherNotice = styled.div` | ||
| padding: 0.5rem 1rem; | ||
| font-size: 0.9rem; | ||
| `; |
43 changes: 43 additions & 0 deletions
43
src/components/customerService/noticeDetail/bottom/NoticeDetailBottom.tsx
This file contains hidden or 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 type { OtherNotice } from '../../../../models/customerService'; | ||
| import ContentBorder from '../../../common/contentBorder/ContentBorder'; | ||
| import ListButton from './button/ListButton'; | ||
| import OtherNoticeButton from './button/OtherNoticeButton'; | ||
| import * as S from './NoticeDetailBottom.styled'; | ||
|
|
||
| interface NoticeDetailBottomProps { | ||
| prev: OtherNotice | null; | ||
| next: OtherNotice | null; | ||
| } | ||
|
|
||
| export default function NoticeDetailBottom({ | ||
| prev, | ||
| next, | ||
| }: NoticeDetailBottomProps) { | ||
| return ( | ||
| <S.Container> | ||
| <ContentBorder /> | ||
| {prev !== null ? ( | ||
| <OtherNoticeButton | ||
| navigation='이전' | ||
| id={prev.id} | ||
| title={prev.title} | ||
| createdAt={prev.createdAt} | ||
YouD0313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /> | ||
| ) : ( | ||
| <S.NotOtherNotice>이전 공지사항이 없습니다.</S.NotOtherNotice> | ||
| )} | ||
| <ContentBorder /> | ||
| {next !== null ? ( | ||
| <OtherNoticeButton | ||
| navigation='다음' | ||
| id={next.id} | ||
| title={next.title} | ||
| createdAt={next.createdAt} | ||
YouD0313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /> | ||
| ) : ( | ||
| <S.NotOtherNotice>다음 공지사항이 없습니다.</S.NotOtherNotice> | ||
| )} | ||
| <ListButton /> | ||
| </S.Container> | ||
| ); | ||
| } | ||
30 changes: 30 additions & 0 deletions
30
src/components/customerService/noticeDetail/bottom/button/ListButton.styled.ts
This file contains hidden or 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,30 @@ | ||
| import { Link } from 'react-router-dom'; | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const ListWrapper = styled.div` | ||
| width: 100%; | ||
| display: flex; | ||
| justify-content: center; | ||
| margin-top: 1.5rem; | ||
| `; | ||
|
|
||
| export const ListLink = styled(Link)` | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| font-size: 0.9rem; | ||
| background: ${({ theme }) => theme.color.navy}; | ||
| border-radius: ${({ theme }) => theme.borderRadius.large}; | ||
| color: ${({ theme }) => theme.color.white}; | ||
| border: 1px solid ${({ theme }) => theme.color.navy}; | ||
| padding: 0.5rem 1rem; | ||
|
|
||
| &:hover { | ||
| background: ${({ theme }) => theme.color.lightgrey}; | ||
| color: ${({ theme }) => theme.color.navy}; | ||
| border: 1px solid ${({ theme }) => theme.color.navy}; | ||
| transition: all 0.3s ease-in-out; | ||
| } | ||
| `; | ||
|
|
||
| export const ListTitle = styled.span``; |
16 changes: 16 additions & 0 deletions
16
src/components/customerService/noticeDetail/bottom/button/ListButton.tsx
This file contains hidden or 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,16 @@ | ||
| import { ROUTES } from '../../../../../constants/routes'; | ||
| import ContentBorder from '../../../../common/contentBorder/ContentBorder'; | ||
| import * as S from './ListButton.styled'; | ||
|
|
||
| export default function ListButton() { | ||
| return ( | ||
| <> | ||
| <ContentBorder /> | ||
| <S.ListWrapper> | ||
| <S.ListLink to={`${ROUTES.customerService}/${ROUTES.notice}`}> | ||
| <S.ListTitle>목록</S.ListTitle> | ||
| </S.ListLink> | ||
| </S.ListWrapper> | ||
| </> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.