-
Notifications
You must be signed in to change notification settings - Fork 50
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
[Team23] Tab section 구현, 컴포넌트 트리 구조 추가 #17
Changes from all commits
d3ecca9
19a4077
a5c4d83
e8dfa3c
b1330fe
f7cb509
2f5389a
da94eff
a0bf96b
489ae39
7d7896c
21d004c
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,12 +1,17 @@ | ||
import styled, { ThemeProvider } from "styled-components"; | ||
import theme from "../../utils/constant.js"; | ||
import styled from "styled-components"; | ||
import HeaderNavbar from "./HeaderNavbar.jsx"; | ||
import { CenterContainer } from "../../utils/styles/common.jsx"; | ||
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. [p4] path를 편리하게 관리하기 위해 alias를 활용하면 좋을 것 같아요. eject 후 빌드 설정을 수정하는 방법이 있고, craco 와 같은 라이브러리를 활용하는 방법도 있습니다! 😀 |
||
|
||
const HeaderLeftDiv = styled.div` | ||
display: flex; | ||
align-items: center; | ||
font-family: Noto Sans KR; | ||
`; | ||
const HeaderLeft = () => { | ||
return ( | ||
<HeaderLeftDiv> | ||
<BanchanTitle>BANCHAN</BanchanTitle> | ||
<HeaderNavbar /> | ||
</HeaderLeftDiv> | ||
); | ||
}; | ||
|
||
const HeaderLeftDiv = styled(CenterContainer)``; | ||
|
||
const BanchanTitle = styled.div` | ||
color: ${(props) => props.theme.colors.darkGray}; | ||
|
@@ -15,15 +20,4 @@ const BanchanTitle = styled.div` | |
margin-right: 12px; | ||
`; | ||
|
||
const HeaderLeft = () => { | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<HeaderLeftDiv> | ||
<BanchanTitle>BANCHAN</BanchanTitle> | ||
<HeaderNavbar /> | ||
</HeaderLeftDiv> | ||
</ThemeProvider> | ||
); | ||
}; | ||
|
||
export default HeaderLeft; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,8 @@ | ||
import React, { useState } from "react"; | ||
import styled, { ThemeProvider } from "styled-components"; | ||
import theme from "../../utils/constant"; | ||
import styled from "styled-components"; | ||
|
||
const NavListItems = ({ list }) => { | ||
const NavLITitle = styled.span` | ||
&:hover { | ||
font-weight: bold; | ||
} | ||
`; | ||
const [isMouseOver, setIsMouseOver] = useState(false); | ||
const NavLI = styled.li` | ||
margin: 0 12px; | ||
`; | ||
|
||
const NavLIBox = styled.ul` | ||
padding: 5px 7px; | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 100px; | ||
min-height: 86px; | ||
background: #ffffff; | ||
box-shadow: 0px 0px 4px rgba(204, 204, 204, 0.5), | ||
0px 2px 4px rgba(0, 0, 0, 0.25); | ||
position: absolute; | ||
top: 65px; | ||
`; | ||
|
||
const SubElementsLI = styled.li` | ||
margin: 3px 0; | ||
&:first-child { | ||
font-weight: bold; | ||
text-decoration: underline; | ||
color: ${(props) => props.theme.colors.darkGray}; | ||
} | ||
color: ${(props) => props.theme.colors.gray}; | ||
font-weight: "400"; | ||
`; | ||
|
||
const handleMouseEnter = () => { | ||
setIsMouseOver((isMouseOver) => (isMouseOver = true)); | ||
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. [p5] 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. 아 그러네요? 당시엔 잘 안보였던 것 같습니다.. 감사합니다 :) |
||
|
@@ -50,13 +17,45 @@ const NavListItems = ({ list }) => { | |
)); | ||
|
||
return ( | ||
<ThemeProvider theme={theme}> | ||
<NavLI onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}> | ||
<NavLITitle>{list.title}</NavLITitle> | ||
{isMouseOver && <NavLIBox>{listSubElements}</NavLIBox>} | ||
</NavLI> | ||
</ThemeProvider> | ||
<NavLI onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}> | ||
<NavLITitle>{list.title}</NavLITitle> | ||
{isMouseOver && <NavLIBox>{listSubElements}</NavLIBox>} | ||
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. [p5] 개인적으로는 현재 마우스 오버 이벤트가 컴포넌트를 보여주고, 숨기기 위한 처리라면 css hover로 처리하는 것도 좋지 않을까 싶습니다! (혹 다른 이벤트나 동작을 추가할 경우가 아니라면요!) 😀. 성능적인 면에서도 css로 조절이 가능한 부분은 최대한 css를 활용하시는 것을 추천합니다. |
||
</NavLI> | ||
); | ||
}; | ||
|
||
const NavLITitle = styled.span` | ||
&:hover { | ||
font-weight: bold; | ||
} | ||
`; | ||
|
||
const NavLI = styled.li` | ||
margin: 0 12px; | ||
`; | ||
|
||
const NavLIBox = styled.ul` | ||
padding: 5px 7px; | ||
display: flex; | ||
flex-direction: column; | ||
min-width: 100px; | ||
min-height: 86px; | ||
background: #ffffff; | ||
box-shadow: 0px 0px 4px rgba(204, 204, 204, 0.5), | ||
0px 2px 4px rgba(0, 0, 0, 0.25); | ||
position: absolute; | ||
top: 65px; | ||
`; | ||
|
||
const SubElementsLI = styled.li` | ||
margin: 3px 0; | ||
&:first-child { | ||
font-weight: bold; | ||
text-decoration: underline; | ||
color: ${(props) => props.theme.colors.darkGray}; | ||
} | ||
color: ${(props) => props.theme.colors.gray}; | ||
font-weight: "400"; | ||
`; | ||
|
||
export default NavListItems; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
import styled, { ThemeProvider } from "styled-components"; | ||
import theme from "../../utils/constant"; | ||
import styled from "styled-components"; | ||
import IconButton from "../../utils/button/IconButton"; | ||
import { CenterContainer } from "../../utils/styles/common"; | ||
|
||
const HeaderRight = (props) => { | ||
const HeaderRightDiv = styled.div` | ||
display: flex; | ||
align-items: center; | ||
`; | ||
|
||
const StyledSpan = styled.span` | ||
margin: 0 12px; | ||
font-size: ${(props) => props.theme.fontSizes.S}; | ||
font-family: "Noto Sans KR"; | ||
cursor: pointer; | ||
&:hover { | ||
font-weight: bold; | ||
} | ||
`; | ||
|
||
const tempFn = () => { | ||
console.log("hello"); | ||
}; | ||
return ( | ||
<HeaderRightDiv> | ||
<ThemeProvider theme={theme}> | ||
<SearchBox> | ||
<input /> | ||
<StyledSpan>로그인</StyledSpan> | ||
<StyledSpan>장바구니</StyledSpan> | ||
</ThemeProvider> | ||
<IconButton type="SEARCH" fn={tempFn} /> | ||
</SearchBox> | ||
<StyledSpan>로그인</StyledSpan> | ||
<StyledSpan>장바구니</StyledSpan> | ||
</HeaderRightDiv> | ||
); | ||
}; | ||
|
||
const HeaderRightDiv = styled(CenterContainer)` | ||
justify-content: start; | ||
`; | ||
|
||
const StyledSpan = styled.span` | ||
margin: 0 12px; | ||
font-size: ${(props) => props.theme.fontSizes.S}; | ||
cursor: pointer; | ||
&:hover { | ||
font-weight: bold; | ||
} | ||
`; | ||
const SearchBox = styled(CenterContainer)` | ||
justify-content: space-between; | ||
border-radius: ${(props) => props.theme.borders.radius}; | ||
background: ${(props) => props.theme.colors.lightGrayBG}; | ||
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. [p5] css를 styled components의 장점을 활용해서 사용하시는 부분이 좋네요. 👍 |
||
width: 248px; | ||
height: 40px; | ||
padding: 0 10px 0 15px; | ||
input { | ||
all: unset; | ||
} | ||
`; | ||
export default HeaderRight; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { useEffect, useState } from 'react'; | ||
import Card from '../utils/Card'; | ||
import theme from '../utils/constant'; | ||
import { useEffect, useState } from "react"; | ||
import Card from "../utils/Card"; | ||
import theme from "../utils/styles/theme"; | ||
|
||
const CarouselSection = (props) => { | ||
const [products, setProducts] = useState([]); | ||
|
||
useEffect(() => { | ||
fetch( | ||
'https://h3rb9c0ugl.execute-api.ap-northeast-2.amazonaws.com/develop/baminchan/main' | ||
"https://h3rb9c0ugl.execute-api.ap-northeast-2.amazonaws.com/develop/baminchan/main" | ||
) | ||
.then((response) => response.json()) | ||
.then((result) => setProducts(result.body)) | ||
.then((error) => console.log('error', error)); | ||
.then((error) => console.log("error", error)); | ||
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. [p4] fetch api를 편리하게 사용하기 위한 custom hook을 만들어보시는 것도 추천합니다. |
||
}, []); | ||
|
||
return ( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import CarouselSection from './CarouselSection'; | ||
import CarouselSection from "./CarouselSection"; | ||
import TabSection from "./tab/TabSection"; | ||
|
||
const MainPage = (props) => <CarouselSection />; | ||
const MainPage = (props) => { | ||
return ( | ||
<> | ||
<TabSection /> | ||
<CarouselSection /> | ||
</> | ||
); | ||
}; | ||
|
||
export default MainPage; |
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.
[p5] 테마 활용 좋네요. 👍