-
Notifications
You must be signed in to change notification settings - Fork 7
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
[SP2] 프로젝트 탭 캐러셀 블러 스타일 수정 #266
Changes from 2 commits
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,50 @@ | ||
import styled from '@emotion/styled'; | ||
import { colors } from '@sopt-makers/colors'; | ||
import { css } from '@emotion/react'; | ||
import arrowLeft from '@src/assets/icons/arrow_left_28x28.svg'; | ||
import arrowRight from '@src/assets/icons/arrow_right_28x28.svg'; | ||
import { HideScrollbar } from '@src/lib/styles/scrollbar'; | ||
import { CarouselArrowType } from '@src/lib/types/universal'; | ||
|
||
const Wrapper = styled(HideScrollbar)` | ||
const Wrapper = styled(HideScrollbar)<{ isSliding: boolean; lastIndex: boolean }>` | ||
width: 100%; | ||
position: relative; | ||
|
||
::before, | ||
::after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
z-index: 5; | ||
|
||
width: 70px; | ||
height: 164px; | ||
} | ||
|
||
::before { | ||
left: 0; | ||
background: linear-gradient(270deg, transparent 0%, ${colors.gray950} 100%); | ||
|
||
opacity: ${({ isSliding }) => (isSliding ? '1' : '0')}; | ||
transition: opacity 0.3s ease-out; | ||
} | ||
|
||
::after { | ||
right: -1px; | ||
background: linear-gradient(270deg, ${colors.gray950} 0%, transparent 100%); | ||
|
||
opacity: 0; | ||
${({ isSliding }) => | ||
isSliding && | ||
css` | ||
opacity: 1; | ||
transition: opacity 0.3s ease-out; | ||
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. transition 속성은 조건문을 걸지 않아도 괜찮지 않나요 ..? 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. 화면 사이즈가 변동 되었을 때는 transition이 없었으면 해서 슬라이드 넘길 때만 적용했습니다! |
||
`}; | ||
|
||
@media (max-width: 1279px) { | ||
opacity: ${({ lastIndex }) => (lastIndex ? 0 : 1)}; | ||
} | ||
} | ||
`; | ||
|
||
const Arrow = styled.div<{ type: CarouselArrowType }>` | ||
|
@@ -46,6 +83,11 @@ const CarouselWrapper = styled.div<{ | |
grid-template-columns: ${({ itemWidth, itemCount }) => `repeat(${itemCount}, ${itemWidth}px)`}; | ||
transition: transform 0.5s ease-in-out; | ||
transform: ${({ translateX }) => `translateX(${translateX}px)`}; | ||
gap: 24px; | ||
|
||
@media (max-width: 899px) { | ||
gap: 14px; | ||
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. gap 숫자를 gapWidth를 props 로 받아서 넣어도 될 것 같아요! 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. 음 미디어쿼리로 할 수 있는데 프롭으로 넘겨야 하는 이유가 무엇인가요? 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. gapWidth라는 값을 컴포넌트가 갖고 있어서 그렇군요 .. 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.
|
||
} | ||
`; | ||
|
||
const CarouselViewport = styled.div` | ||
|
@@ -58,12 +100,7 @@ const Blur = styled.div` | |
height: 100%; | ||
width: calc(50vw - 50%); | ||
top: 0; | ||
background: linear-gradient( | ||
to right, | ||
transparent 10px, | ||
${colors.background} 50px, | ||
${colors.background} | ||
); | ||
background: ${colors.background}; | ||
`; | ||
|
||
const LeftBlur = styled(Blur)` | ||
|
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.
right
를 -1px
로 준 이유는0
으로 주면 크롬 개발자 도구 반응형으로 봤을 때 끝 부분까지 덮이지 않는 것처럼 보이기 때문입니다.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.
오호... 왜 안덮히는 걸까요...? 신기하네요..!