Skip to content
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

게시판 퍼블리싱, pages 디렉터리명 변경 #22

Merged
merged 23 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dc0fde0
fix(layout): 사이드바 크기 조절
Ubinquitous Jul 1, 2023
803eace
fix(layout): 호수, 이름 gap 속성 확장
Ubinquitous Jul 1, 2023
e9ae821
feat(adaptors): 어댑터 기본 세팅
Ubinquitous Jul 1, 2023
587b296
chore(assets): 좋아요 svg 파일 추가
Ubinquitous Jul 1, 2023
ba11d98
feat(forum): 게시판 퍼블리싱
Ubinquitous Jul 1, 2023
5e50681
feat(category): 카테고리 퍼블리싱
Ubinquitous Jul 1, 2023
0de9543
feat(forum): 게시판 전체 컨테이너 퍼블리싱
Ubinquitous Jul 1, 2023
f77bab6
feat(forum filter): 게시판 필터 퍼블리싱
Ubinquitous Jul 1, 2023
8cdaa7c
feat(forum list): 게시판 글 목록 컴포넌트 정의
Ubinquitous Jul 1, 2023
3a7201f
feat(forum list item): 게시판 글 퍼블리싱
Ubinquitous Jul 1, 2023
96acc36
fix(page): pages로 디렉터리명을 명명하자 routing에서 오류가 나 디렉터리명 변경
Ubinquitous Jul 1, 2023
d8a7fa0
chore(contant): filter type constant key로 지정
Ubinquitous Jul 1, 2023
0e472c5
fix(httpClient): baseURL bssm.kro.kr로 수정
Ubinquitous Jul 1, 2023
2390727
feat(forum): forum 페이지 라우터 설정
Ubinquitous Jul 1, 2023
2e037d1
chore(package): 패키지 의존성 업데이트
Ubinquitous Jul 1, 2023
15e5837
fix(vscode setting): yarn berry setting 속성 삭제
Ubinquitous Jul 1, 2023
4eaaedb
refactor(forum key): forum constant 카테고리 추가
Ubinquitous Jul 1, 2023
d629d1b
refactor(constant): .constants.key에서 .constant.key로 이름 변경
Ubinquitous Jul 1, 2023
a4382e2
refactor(constant): 경로 변경, constant 적용
Ubinquitous Jul 1, 2023
022a3f1
chore(dir): gitkeep 파일 삭제
Ubinquitous Jul 1, 2023
356e8c2
chore(package): dotenv 의존성 추가
Ubinquitous Jul 1, 2023
99157c4
refactor(httpClient): env로 base url 숨김처리
Ubinquitous Jul 1, 2023
09793b7
refactor(forum filter): filters map props 이름 변경
Ubinquitous Jul 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
"**/.yarn": true,
"**/.pnp.*": true
},
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"git.ignoreLimitWarning": true
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@typescript-eslint/eslint-plugin": "^5.43.0",
"axios": "^1.4.0",
"babel-plugin-styled-components": "^2.1.4",
"dotenv": "^16.3.1",
"eslint": "^8.26.0",
"eslint-config-next": "13.0.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/apis/httpClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ export class HttpClient {
}

export const axiosConfig: HttpClientConfig = {
baseURL: "http://localhost:3000/api",
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
timeout: 10000,
};
2 changes: 1 addition & 1 deletion src/apis/interceptor/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Storage from "@/apis/storage";
import { AxiosRequestConfig, AxiosResponse } from "axios";
import refreshToken from "@/apis/token/refreshToken";
import exception from "@/utils/constants/exception.constants";
import exception from "@/utils/constants/exception.constant";

export const requestInterceptors = (requestConfig: AxiosRequestConfig) => {
if (!Storage.getItem("access_token") && Storage.getItem("refresh_token"))
Expand Down
10 changes: 10 additions & 0 deletions src/app/forum/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use client";

import ForumPage from "@/page/forum";
import React from "react";

const Forum = () => {
return <ForumPage />;
};

export default Forum;
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import HomePage from "@/pages/home";
import HomePage from "@/page/home";
import React from "react";

const Home = () => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/Aside/JoinCheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const JoinCheckBox = () => {
return (
<Container>
<HGroup>
<Date>2023년 7월 1주차</Date>
<Row gap="2px">
<Date>7월 1주차</Date>
<Row gap="4px">
<RoomNumber>334</RoomNumber>
<UserName>박우빈</UserName>
</Row>
Expand All @@ -35,6 +35,8 @@ const HGroup = styled.hgroup`
display: flex;
flex-direction: column;
gap: 4px;
margin-right: auto;
padding-left: 18px;
`;

const Date = styled.span`
Expand Down
2 changes: 1 addition & 1 deletion src/components/Aside/MeisterBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import color from "@/styles/color";
import { font } from "@/styles/font";
import React from "react";
import styled from "styled-components";
import service from "@/utils/constants/service.constants";
import service from "@/utils/constants/service.constant";
import Row from "../Flex/Row";

const scores = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/Aside/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Aside = () => {
};

const Container = styled.aside`
width: 28vw;
width: 24vw;
display: flex;
gap: 6px;
margin-left: auto;
Expand Down
5 changes: 5 additions & 0 deletions src/page/forum/adaptors/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HttpClient, axiosConfig } from "@/apis/httpClient";

export default {
forum: new HttpClient("/forum", axiosConfig),
};
3 changes: 3 additions & 0 deletions src/page/forum/assets/like.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/page/forum/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Aside from "@/components/Aside";
import React from "react";
import styled from "styled-components";
import Forum from "./layouts/Forum";

const ForumPage = () => {
return (
<Layout>
<Container>
<Forum />
<Aside />
</Container>
</Layout>
);
};

const Layout = styled.div`
width: 100%;
display: flex;
justify-content: center;
`;

const Container = styled.div`
width: 76%;
display: flex;
justify-content: center;
gap: 8px;
`;

export default ForumPage;
82 changes: 82 additions & 0 deletions src/page/forum/layouts/Categories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import Row from "@/components/Flex/Row";
import color from "@/styles/color";
import { font } from "@/styles/font";
import forum from "@/utils/constants/forum.constant";
import React from "react";
import styled, { css } from "styled-components";

const categories = [
{
name: forum.category.all.name,
type: forum.category.all.type,
},
{
name: forum.category.complain.name,
type: forum.category.complain.type,
},
{
name: forum.category.humor.name,
type: forum.category.humor.type,
},
{
name: forum.category.infomation.name,
type: forum.category.infomation.type,
},
];

const Categories = () => {
const [checked, setChecked] = React.useState(forum.category.all.type);

const onCheckCategory = (e: React.ChangeEvent<HTMLInputElement>) => {
setChecked(e.target.id);
};

return (
<Row gap="6px">
{categories.map((category) => (
<Row key={category.type}>
<Category
type="radio"
id={category.type}
name="category"
onChange={onCheckCategory}
/>
<CategoryLabel
htmlFor={category.type}
checked={category.type === checked}
>
{category.name}
</CategoryLabel>
</Row>
))}
</Row>
);
};

const Category = styled.input`
display: none;
`;

const CategoryLabel = styled.label<{ checked: boolean }>`
border: none;
width: 64px;
height: 26px;
border-radius: 999px;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 0 10px 0 rgba(144, 144, 144, 0.1);
${font.btn3};
${({ checked }) =>
checked
? css`
background-color: ${color.primary_blue};
color: ${color.white};
`
: css`
background-color: ${color.white};
color: ${color.gray};
`}
`;

export default Categories;
24 changes: 24 additions & 0 deletions src/page/forum/layouts/Forum.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
import styled from "styled-components";
import ForumFilter from "./ForumFilter";
import Categories from "./Categories";
import PostList from "./PostList";

const Forum = () => {
return (
<Container>
<ForumFilter />
<Categories />
<PostList />
</Container>
);
};

const Container = styled.main`
width: 76%;
display: flex;
flex-direction: column;
gap: 13px;
`;

export default Forum;
65 changes: 65 additions & 0 deletions src/page/forum/layouts/ForumFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import Row from "@/components/Flex/Row";
import color from "@/styles/color";
import { font } from "@/styles/font";
import forum from "@/utils/constants/forum.constant";
import React from "react";
import styled, { css } from "styled-components";

const filters = [
{
type: forum.student.type,
name: forum.student.name,
},
{
type: forum.free.type,
name: forum.free.name,
},
];

const ForumFilter = () => {
const [checked, setChecked] = React.useState(forum.student.type);

const onCheckFilter = (e: React.ChangeEvent<HTMLInputElement>) => {
setChecked(e.target.id);
};

return (
<Row gap="14px" alignItems="center">
{filters.map((filter) => (
<Row key={filter.type}>
<ForumLabel checked={filter.type === checked} htmlFor={filter.type}>
{filter.name}
</ForumLabel>
<ForumRadio
onChange={onCheckFilter}
type={forum.type}
id={filter.type}
name={forum.name}
/>
</Row>
))}
</Row>
);
};

const ForumRadio = styled.input`
display: none;
`;

const ForumLabel = styled.label<{ checked: boolean }>`
${({ checked }) =>
checked
? css`
${font.H2};
`
: css`
${font.H3};
color: ${color.gray};
`}

&:after {
content: "게시판";
}
`;

export default ForumFilter;
15 changes: 15 additions & 0 deletions src/page/forum/layouts/PostList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Column from "@/components/Flex/Column";
import React from "react";
import PostListItem from "./PostListItem";

const PostList = () => {
return (
<Column gap="8px">
{[1, 2, 3, 4, 5, 6, 7, 8].map((key) => (
<PostListItem key={key} />
))}
</Column>
);
};

export default PostList;
67 changes: 67 additions & 0 deletions src/page/forum/layouts/PostListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Column from "@/components/Flex/Column";
import Row from "@/components/Flex/Row";
import color from "@/styles/color";
import { font } from "@/styles/font";
import React from "react";
import styled from "styled-components";
import Like from "@/page/forum/assets/like.svg";
import Image from "next/image";

const PostListItem = () => {
return (
<Container>
<PostNumber>01</PostNumber>
<Column>
<PostName>게시판 타이틀입니다</PostName>
<Row gap="8px">
<PostView>83</PostView>
<Row alignItems="center" gap="3px">
<Image src={Like} alt="like" />
<PostLike>30</PostLike>
</Row>
</Row>
</Column>
</Container>
);
};

const Container = styled.article`
width: 100%;
height: 80px;
background-color: ${color.white};
display: flex;
align-items: center;
padding: 0px 32px;
box-shadow: 0 0 10px 0 rgba(144, 144, 144, 0.1);
border-radius: 4px;
gap: 24px;
`;

const PostNumber = styled.span`
${font.H3};
font-weight: 800;
`;

const PostName = styled.h1`
${font.H4};
`;

const PostView = styled.span`
${font.p3};
color: ${color.gray};

&:before {
content: "조회수 ";
}

&:after {
content: "회";
}
`;

const PostLike = styled.span`
${font.p3};
color: ${color.gray};
`;

export default PostListItem;
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/pages/home/index.tsx → src/page/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Aside from "@/components/Aside";
import color from "@/styles/color";
import React from "react";
import styled from "styled-components";

Expand Down
File renamed without changes.
Empty file.
Empty file removed src/pages/meister/assets/.gitkeep
Empty file.
Empty file removed src/pages/meister/layouts/.gitkeep
Empty file.
Empty file.
Loading