-
Notifications
You must be signed in to change notification settings - Fork 51
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
[Week14] 김하늘 #510
The head ref may contain hidden characters: "part3-\uAE40\uD558\uB298-week14"
[Week14] 김하늘 #510
Changes from all commits
964d67d
0cdc1be
1c221b1
6dd4d1c
2018b77
33c15ef
f7b6586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import { CutLine, StyledHeader, StyledImage, Title, WrapperLink } from "@/components/Header/index/HomeHeader.styled"; | ||
import Link from "next/link"; | ||
import { useEffect } from "react"; | ||
|
||
let locate = "/folder"; | ||
import { useRef } from "react"; | ||
|
||
export default function HomeHeader() { | ||
const locate = useRef("/signin"); | ||
const accessToken = typeof window !== "undefined" ? sessionStorage.getItem("accessToken") : null; | ||
if (accessToken) { | ||
locate = `/folder?a=${accessToken}`; | ||
locate.current = `/folder`; | ||
} | ||
Comment on lines
+6
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. useRef를 이용하여 locate 값을 설정하고 있지만, useEffect나 조건부 렌더링을 활용하여 해당 값의 설정을 컴포넌트 마운트 이후에 하는 것이 좋을 수 있습니다. 아래 return 구문의 |
||
|
||
return ( | ||
|
@@ -22,9 +21,7 @@ export default function HomeHeader() { | |
<p>구경 해보기</p> | ||
<Link href="/shared">폴더 공유하기</Link> | ||
<CutLine /> | ||
<Link href={locate} as="/folder"> | ||
링크 추가하기 | ||
</Link> | ||
<Link href={locate.current}>링크 추가하기</Link> | ||
</WrapperLink> | ||
<StyledImage priority width={1} height={1} src="index/_img.svg" alt="링크검색기능 예시이미지" /> | ||
</StyledHeader> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import styled from "styled-components"; | ||
|
||
export const WrapperCardImg = styled.div` | ||
height: 20.5rem; | ||
margin: 0 auto; | ||
overflow: hidden; | ||
border-top-right-radius: 1.5rem; | ||
border-top-left-radius: 1.5rem; | ||
`; | ||
|
||
export const CardImg = styled.img` | ||
width: 34rem; | ||
height: 100%; | ||
border-radius: 1.5rem 1.5rem 0 0; | ||
object-fit: cover; | ||
`; | ||
|
||
export const CardText = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
height: 13.5rem; | ||
padding: 1.5rem 2rem; | ||
gap: 1rem; | ||
`; | ||
|
||
export const WrapperTime = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
font-size: 1.2rem; | ||
color: var(--Gray5); | ||
`; | ||
|
||
export const H3 = styled.h3` | ||
font-size: 1.4rem; | ||
`; | ||
|
||
export const ButtonStar = styled.button` | ||
position: absolute; | ||
top: 1.5rem; | ||
right: 1.5rem; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ButtonStar, CardImg, CardText, H3, WrapperCardImg, WrapperTime } from "@/components/Main/CardList/Card.styled"; | ||
import { CardProps } from "@/components/Main/CardList/CardList.type"; | ||
import Kebab from "@/components/Main/CardList/Kebab"; | ||
import TimeFlow from "@/components/Main/CardList/TimeFlow"; | ||
import { formatDate } from "@/utils/filterAndData"; | ||
import Image from "next/image"; | ||
import starImg from "@/public/star.svg"; | ||
|
||
export default function Card({ folder, url, imageSource, image_source, title, description, createdAt, created_at }: CardProps) { | ||
return ( | ||
<> | ||
<WrapperCardImg> | ||
<CardImg src={imageSource || image_source || "/nofileimg.png"} alt="카드 이미지" /> | ||
</WrapperCardImg> | ||
<CardText> | ||
<WrapperTime> | ||
<TimeFlow createdAt={createdAt ?? (created_at as string)} /> | ||
{folder && <Kebab folder={folder} url={url} />} | ||
</WrapperTime> | ||
<H3>{title?.length > 40 ? title.slice(0, 40) + "..." : title}</H3> | ||
<p>{description?.length > 50 ? description.slice(0, 50) + "..." : description}</p> | ||
<p>{formatDate(createdAt ?? (created_at as string))}</p> | ||
Comment on lines
+13
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 내부에 연산 값이 많아 가독성을 헤칩니다. 상단 변수로 올려서 computed하게 변수를 만들어 사용하는 것을 추천드려요. |
||
</CardText> | ||
<ButtonStar> | ||
<Image src={starImg} alt="즐겨찾기에 추가하기" /> | ||
</ButtonStar> | ||
</> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 input은 어디에 사용되는건가요? 화면에도 출력되지 않아보이네요.