Skip to content
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
38 changes: 0 additions & 38 deletions src/App.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/App.js

This file was deleted.

6 changes: 4 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Home from "./pages/home";
import SignUp from "./pages/sign/SignUp";
import Signup from "./pages/sign/Signup";
import Items from "./pages/items";
import GNB from "@/components/GNB";
import { WinSizeProvider } from "./contexts/winSizeContext";
import Login from "./pages/sign/LogIn";
import AddItem from "./pages/additem";

function App() {
return (
Expand All @@ -15,10 +16,11 @@ function App() {
<Routes>
<Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/signup" element={<Signup />} />
<Route path="/items" element={<Items />}>
{/* <Route index element={<Items />} /> */}
</Route>
<Route path="/additem" element={<AddItem />} />
</Routes>
</BrowserRouter>
</WinSizeProvider>
Expand Down
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/assets/icons/ico_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/ico_plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 50 additions & 41 deletions src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,53 @@
import styled from "styled-components";
import color from "../utils/color";
import { Link } from "react-router-dom";

const ButtonContainer = styled.button`
justify-content: center;
align-items: center;
border: none;
background: ${color("primary100")};
color: ${color("secondary200")};
font: 500 20px/32px "Pretendard";
cursor: pointer;
transition: all 0.05s ease-out;
text-align: center;
text-decoration: none;
border-radius: ${(props) => (props.round ? "40px" : "8px")};
width: ${(props) => props.width};
height: ${(props) => props.height};
line-height: ${(props) => props.height};
display: block;
padding: 0 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

font-size: ${(props) =>
props.round ? (props.height > "48px" ? "20px" : "18px") : "16px"};

.link {
const ButtonContainer = styled.div`
.btn {
justify-content: center;
align-items: center;
border: none;
background: ${color("primary100")};
color: ${color("secondary200")};
font: 500 20px/32px "Pretendard";
cursor: pointer;
transition: all 0.05s ease-out;
text-align: center;
text-decoration: none;
color: white;
}
border-radius: ${(props) => (props.round ? "40px" : "8px")};
width: ${(props) => props.width};
height: ${(props) => props.height};
line-height: ${(props) => props.height};
display: block;
padding: 0 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

&:hover {
background: #1967d6;
}
font-size: ${(props) =>
props.round ? (props.height > "48px" ? "20px" : "18px") : "16px"};

&:active {
background: ${color("primary300")};
}
&:hover {
background: #1967d6;
}

&[disabled] {
background: ${color("secondary400")};
cursor: not-allowed;
}
&:active {
background: ${color("primary300")};
}

${(props) =>
props.outline &&
`
&[disabled] {
background: ${color("secondary400")};
cursor: not-allowed;
}

${(props) =>
props.outline &&
`
background: ${color("secondary10")};
color: ${color("primary100")};
border: 1px solid ${color("primary100")};
`}
}
`;

function Button({
Expand All @@ -58,6 +56,8 @@ function Button({
height = "42px",
round = false,
outline = false,
to,
disabled = false,
...rest
}) {
return (
Expand All @@ -67,8 +67,17 @@ function Button({
height={height}
round={round}
outline={outline}
to={to}
>
{children}
{to ? (
<Link className="btn" to={to} disabled={disabled}>
{children}
</Link>
) : (
<button className="btn" disabled={disabled}>
{children}
</button>
)}
</ButtonContainer>
);
}
Expand Down
13 changes: 6 additions & 7 deletions src/components/GNB.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const GNBContainer = styled.header`

&-market {
color: ${(props) =>
props.currentPath === "/items"
props.currentPath === "/items" || props.currentPath === "/additem"
? color("primary100")
: color("secondary600")};
}
Expand Down Expand Up @@ -94,17 +94,16 @@ function GNB() {
<img src={LogoTypoOnly} alt="판다마켓 로고" />
</picture>
</Link>
{location.pathname === "/items" && (
{(location.pathname === "/items" ||
location.pathname === "/additem") && (
<div className="link-container">
<Link className="link link-board">자유게시판</Link>
<Link className="link link-market">중고마켓</Link>
</div>
)}
<Link to="/login" className="sign-button">
<Button width="128px" height="48px">
로그인
</Button>
</Link>
<Button width="128px" height="48px" to="/login" className="sign-button">
로그인
</Button>
</div>
</GNBContainer>
);
Expand Down
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

1 change: 0 additions & 1 deletion src/logo.svg

This file was deleted.

59 changes: 59 additions & 0 deletions src/pages/additem/FileInput/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { useState } from "react";

import IcoClose from "@/assets/icons/ico_close.svg";
import IcoPlus from "@/assets/icons/ico_plus.svg";

import * as ParentS from "../style";
import * as CurrentS from "./style";

function FileInput({ title, ...rest }) {
const [thumbnail, setThumbnail] = useState("");
const [warning, setWarning] = useState("");

function handleFileUpload(e) {
let fileArr = e.target.files;
let image = window.URL.createObjectURL(fileArr[0]);
setThumbnail(image);
}

function handleOnClick(e) {
if (thumbnail) {
e.preventDefault();
setWarning("*이미지 등록은 최대 1개까지 가능합니다");
}
}

return (
<ParentS.Label>
Copy link
Collaborator

Choose a reason for hiding this comment

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

옆에 빈 공간을 눌러도 파일 업로더가 나옵니다🤣

{title}
<input
type="file"
accept=".png, .jpeg, .jpg"
style={{ display: "none" }}
Copy link
Collaborator

@dongqui dongqui Apr 10, 2025

Choose a reason for hiding this comment

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

hidden 속성을 쓰실 수 있어요! :)

<input hidden />

onChange={handleFileUpload}
onClick={handleOnClick}
{...rest}
/>
<CurrentS.FileContainer>
<CurrentS.File>
<img src={IcoPlus} />
<span>이미지 등록</span>
</CurrentS.File>
{thumbnail && (
<CurrentS.File
Copy link
Collaborator

Choose a reason for hiding this comment

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

개인적으로, 사용자 경험상 이미지를 눌렀을 때 지워지는 게 조금은 어색한 거 같아요! 요거는 그냥 참고만 해주세요 :)

onClick={(e) => {
e.preventDefault();
setThumbnail("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

인풋에 올라온 파일도 처리해 주셔야합니다~!

}}
>
<img className="close" src={IcoClose} alt="" />
<img className="thumbnail" src={thumbnail} />
</CurrentS.File>
)}
</CurrentS.FileContainer>
<span className="warning">{warning}</span>
</ParentS.Label>
);
}

export default FileInput;
51 changes: 51 additions & 0 deletions src/pages/additem/FileInput/style.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import styled from "styled-components";
import color from "@/utils/color";

export const File = styled.div`
width: 282px;
height: 282px;

position: relative;
border-radius: 12px;
background: ${color("secondary200")};
color: ${color("secondary400")};

display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

overflow: hidden;

font-size: 16px;
font-weight: 400;
transition: all 0.1s ease-out;

@media (max-width: 1200px) {
width: 168px;
height: 168px;
}

.thumbnail {
width: 100%;
}

.close {
position: absolute;
top: 12px;
right: 12px;
}

&:hover {
filter: brightness(0.95);
}
`;

export const FileContainer = styled.div`
display: flex;
gap: 24px;

@media (max-width: 1200px) {
gap: 10px;
}
`;
Loading
Loading