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

♻ :: MajorLine 컴포넌트 분리 #39

Merged
merged 24 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Link } from "react-router-dom";
import Sidname from "../../Sidebar/Side/side";
import Sidname from "../Sidebar/Side/side";
import Head from "src/Components/head/Head/head";
import "./Competition.css";
import { useNavigate } from "react-router-dom";
Expand Down
64 changes: 64 additions & 0 deletions SOPOLAST/src/Components/Portfolio/portfolioMain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import Sidename from "src/constants/Sidebar/Side/side";
import "./protfolio.css";
import Head from "../../constants/head/Head/head"
import MajorLine from "../../constants/MajorLine/Major"
import axios from "axios";

import * as S from "./portfolioMain.style";

export default function Portfolio() {
const [users, setUsers] = useState([]);
const [activeUser, setActiveUser] = useState(null);
const navigate = useNavigate();

useEffect(() => {
const fetchUsers = async () => {
try {
const response = await axios.get("히ㅣㅎ api");
setUsers(response.data);
} catch (error) {
console.error("Error fetching users:", error);
}
};

fetchUsers();
}, []);

const handleNameCardClick = (user) => {
setActiveUser(user);
};

return (
<div className="main">
<div className="content">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css 코드 완전히 삭제 해주세요

<Head active={true} />

<S.SearchBox>
<S.Search>
<S.Searchbox />
<S.SearchIcon type="button" />
<S.serchIconLine />
</S.Search>
<MajorLine/>
</S.SearchBox>

<Sidename />
<S.Mo>
{users.map((user) => (
<S.NameCardBox
key={user.id}
className="namecardBox"
onClick={() => handleNameCardClick(user)}
>
<S.CardName>{user.name}</S.CardName>
<S.CardGrade>{user.grade}</S.CardGrade>
<S.CardMail>{user.mail}</S.CardMail>
</S.NameCardBox>
))}
</S.Mo>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import yogiyo from "src/Assets/image/1.png";
import comment from "src/Assets/image/comment.png";
import Head from "src/Components/head/Head/head";
import Sidebar from "../../Sidebar/Side/side";
import Sidebar from "../Sidebar/Side/side";

import * as S from "./portfolioSub.style";

Expand Down
20 changes: 10 additions & 10 deletions SOPOLAST/src/Components/Router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import GlobalStyles from "src/Style/global";
import Updown from "src/Components/common/Updown/updownmain";
import Login from "src/Components/common/Auth/Login/login";
import Portfolio from "src/Components/common/Portfolio/portfolioMain";
import Updown from "@src/Components/Updown/updownmain";
import Login from "@src/Components/Auth/Login/login";
import Portfolio from "@src/Components/Portfolio/portfolioMain";
import Main from "src/Pages/MainPage/mainpage";
import Write from "src/Components/common/Sidewrite/write";
import Signup from "src/Components/common/Auth/Signup/signup";
import Mypage from "src/Components/common/Mypage/mypage";
import Competition from "src/Components/common/Competition/Competition";
import Portfoliosub from "src/Components/common/Portfoliosub/portfolioSub";
import Updownsub from "src/Components/common/Updownsub/postshow";
import CompetitionSub from "src/Components/common/compsub/competitionsub";
import Write from "@src/Components/Sidewrite/write";
import Signup from "@src/Components/Auth/Signup/signup";
import Mypage from "@src/Components/Mypage/mypage";
import Competition from "@src/Components/Competition/Competition";
import Portfoliosub from "@src/Components/Portfoliosub/portfolioSub";
import Updownsub from "@src/Components/Updownsub/postshow";
import CompetitionSub from "@src/Components/compsub/competitionsub";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { RecoilRoot } from "recoil";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from "styled-components";
export const Main = styled.div`
display: flex;
width: 100vw;
height: 100vh;
height: 150vh;
`;
export const Write_Main = styled.div`
display: flex;
Expand Down Expand Up @@ -47,7 +47,9 @@ export const CategorySelect = styled.select`
background-color: rgb(241, 241, 241);
appearance: none;
`;
export const SubmitButton = styled.button`

export const SubmitButton = styled.input.attrs({ type: 'submit', value: "Submit" })`
z-index: 5;
cursor: pointer;
border: none;
width: 100%;
Expand Down Expand Up @@ -87,21 +89,24 @@ export const WriteTitlelMain = styled.div`
justify-content: center;
width: 100%;
height: 100px;

`;
export const WriteTitle = styled.input`
display: flex;
outline: none;
border: none;
width: 80%;
height: 100px;
height: 75%;
flex-shrink: 0;
font-size: 30px;
padding-left: 10px;
padding-top: 20px;
border-bottom: 1px solid #dbdbdb;
`;
export const WriteDetailMain = styled.div`
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
width: 100%;
height: 100%;
`;
Expand All @@ -114,7 +119,6 @@ export const WriteDetail = styled.textarea`
width: 80%;
height: 100%;
font-size: 30px;
border-top: 1px solid #dbdbdb;
padding-top: 10px;
padding-left: 10px;
`;
Expand All @@ -141,3 +145,8 @@ export const SubmitButtonMain = styled.button`
cursor: pointer;
background-color: white;
`;
export const WriteImg = styled.img`
display: flex;
width: 70%;
height: 500px;
`
110 changes: 110 additions & 0 deletions SOPOLAST/src/Components/Sidewrite/write.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import React from "react";
import { useState, ChangeEvent, FormEvent } from "react";
import axios from "axios";
import Head from "src/Components/head/Head/head";
import Side from "src/Components/Sidebar/Side/side";
import ImgPlus from "src/Assets/image/imgplus.png";
import SubmitImg from "src/Assets/image/submitimg.png";
import * as s from "./Write.style";
import { showToast } from "src/constants/Swal/Swal";
import UseWrite from "src/hooks/Write/useWirte";

const Sidewrite = () => {
const {
title,
setTitle,
content,
setContent,
selectPlace,
setselectPlace,
Class,
setSelectClass,
selectedImg,
handleChangeImg,
onSubmitHandler,
} = UseWrite();
return (
<s.Main>
<Head active={false} />
<Side />
<s.Write_Main>
<s.Writing>
<s.From onSubmit={onSubmitHandler}>
<s.WriteTool>
<s.Tool>
<span>올릴곳</span>
<s.CategorySelect
onChange={(e) => setselectPlace(e.target.value)}
>
<option value="게시물">게시물</option>
<option value="대회">대회</option>
</s.CategorySelect>
</s.Tool>
<s.Tool>
<span>카테고리</span>
<s.CategorySelect
onChange={(e) => setSelectClass(e.target.value)}
>
<option value="web">웹</option>
<option value="server">서버</option>
<option value="Android">안드로이드</option>
<option value="iOS">iOS</option>
<option value="Embedded">임베디드</option>
<option value="design">디자인</option>
<option value="etc">기타</option>
</s.CategorySelect>
</s.Tool>
<s.Tool>
<span>이미지추가</span>
<s.plustimg>
<label htmlFor="change-img">
<img src={ImgPlus} />
</label>
<s.btnupload
name="file"
type="file"
id="change-img"
onChange={handleChangeImg}
></s.btnupload>
</s.plustimg>
</s.Tool>

<s.SubmitButtonMain>
<s.SubmitButton></s.SubmitButton>
<s.plustimg>
<img src={SubmitImg} />
</s.plustimg>
</s.SubmitButtonMain>
</s.WriteTool>
<s.WriteUnder>
<s.WriteForm>
{/* <div className="write_img1">
{imageSrc && <img src={imageSrc} alt="Preview" />}
</div> */}
<s.WriteTitlelMain>
<s.WriteTitle
type="text"
placeholder="제목"
value={title}
onChange={(e) => setTitle(e.target.value)}
/>
</s.WriteTitlelMain>
<s.WriteDetailMain>
{selectedImg && <s.WriteImg src={selectedImg} />}
<s.WriteDetail
placeholder="내용"
value={content}
onChange={(e) => setContent(e.target.value)}
></s.WriteDetail>
</s.WriteDetailMain>
{/* {fileName && <div>{fileName}</div>} */}
</s.WriteForm>
</s.WriteUnder>
</s.From>
</s.Writing>
</s.Write_Main>
</s.Main>
);
};

export default Sidewrite;
92 changes: 92 additions & 0 deletions SOPOLAST/src/Components/Updown/Post/Post.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React, { useState, useEffect } from "react";
import axios from "axios";
import { useNavigate } from "react-router-dom";
import Magnifying from "src/constants/magnifying/Magnifying/Magnifying";
import * as s from "src/Components/Updown/Post/Post.Style";
import SEOUL from "src/Assets/image/3.png";
import { link } from "fs";
import Pagination from "src/constants/Pagination/Pagination";
interface Post {
id: number;
author: string;
title: string;
content: string;
date: string;
image: string;
}

export default function UpdownPost() {
const navigate = useNavigate();
const [currentPage, setCurrentPage] = useState<number>(1);
const [postsPerPage] = useState<number>(10);
const [posts, setPosts] = useState<Post[]>([]);
const [boardList, setBoardList] = useState([]);

const getBoardList = async () => {
const resp = await (await axios.get('SERVER_URL')).data; // 2) 게시글 목록 데이터에 할당
setBoardList(resp.data); // 3) boardList 변수에 할당
console.log(boardList);
}

useEffect(() => {
getBoardList(); // 1) 게시글 목록 조회 함수 호출
}, []);

//페이지네이션 변경 시 이벤트 처리
const paginate = (pageNumber: number) => setCurrentPage(pageNumber);
return (
<s.PostMain>
<s.PostMainView>
<Magnifying />
<s.Post_border>
<s.PostWrite
onClick={() => {
navigate("/Updownsub");
}}
>
<s.PostZonecontrol>
<span> 김가영 </span>
<span> 4개교 연합 해커톤 프론트엔드 </span>
<span>
2023년 08월 24일 4개교 연합 해커톤을 진행했다.고종현 님
@manudeli 경력 요기요에서 -Merchant trine : 사장님 관련 서비스
사장 사이트, 사장 관리자 서비스 공통 요기요 디자인, FE 나의
이야기 제대 전, 수포자 고등학생에서 미대생(디자인전공)으로서의
삶...
</span>
<span>2023.11.02</span>
</s.PostZonecontrol>
<s.Postimg>
<img src={SEOUL} alt="이미지"></img>
</s.Postimg>
</s.PostWrite>
</s.Post_border>
<s.Post_border>
<s.PostWrite
onClick={() => {
navigate("/Updownsub");
}}
>
{boardList.map((board) => (
// 4) map 함수로 데이터 출력
<s.PostZonecontrol>
<span key={board.author}>{board.name}</span>
<span key={board.title}>{board.title}</span>
<span key={board.content}>{board.content}</span>
<span key={board.data}>{board.data}</span>
<s.Postimg>
<img key={board.image}>{board.image}</img>
</s.Postimg>
</s.PostZonecontrol>
))}
</s.PostWrite>
</s.Post_border>
<Pagination
postsPerPage={postsPerPage}
totalPosts={posts.length}
paginate={paginate}
/>
</s.PostMainView>
</s.PostMain>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from "react";
import { Link, useNavigate } from "react-router-dom";
import Sidename from "src/Components/Sidebar/Side/side";
import Head from "src/Components/head/Head/head";
import UpdownPost from "src/Components/common/Updown/Post/Post";
import UpdownPost from "@src/Components/Updown/Post/Post";

import * as s from "src/Components/common/Updown/Updown.style";
import * as s from "@src/Components/Updown/Updown.style";

export default function Updown() {
const navigate = useNavigate();
Expand Down
1 change: 1 addition & 0 deletions SOPOLAST/src/Components/Updownsub/postshow.Style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import styled from "styled-components";
Loading