-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from SWM-FIRE/FIRE-292-fe-horizontal-arrow-생성
FIRE-292-fe-horizontal-arrow-생성
- Loading branch information
Showing
6 changed files
with
216 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
import { VisibilityContext } from 'react-horizontal-scrolling-menu'; | ||
|
||
function Left({ | ||
children, | ||
onClick, | ||
}: { | ||
children: React.ReactNode; | ||
onClick: () => void; | ||
}) { | ||
const [show, setShow] = useState(false); | ||
return show ? ( | ||
<Button | ||
margin={10} | ||
border={[2, 0, 0, 2]} | ||
left | ||
onClick={onClick} | ||
onMouseLeave={() => { | ||
setShow(false); | ||
}} | ||
> | ||
{children} | ||
</Button> | ||
) : ( | ||
<Transparent | ||
margin={10} | ||
border={[2, 0, 0, 2]} | ||
left | ||
onMouseEnter={() => { | ||
setShow(true); | ||
}} | ||
/> | ||
); | ||
} | ||
function Right({ | ||
children, | ||
onClick, | ||
}: { | ||
children: React.ReactNode; | ||
onClick: () => void; | ||
}) { | ||
const [show, setShow] = useState(false); | ||
return show ? ( | ||
<Button | ||
margin={0} | ||
border={[0, 2, 2, 0]} | ||
left={false} | ||
onClick={onClick} | ||
onMouseLeave={() => { | ||
setShow(false); | ||
}} | ||
> | ||
{children} | ||
</Button> | ||
) : ( | ||
<Transparent | ||
margin={0} | ||
border={[0, 2, 2, 0]} | ||
left={false} | ||
onMouseEnter={() => { | ||
setShow(true); | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
interface Props { | ||
margin: number; | ||
border: number[]; | ||
left?: boolean; | ||
} | ||
|
||
const Transparent = styled.div<Props>` | ||
background-color: transparent; | ||
${(props) => props.color} | ||
width: 10rem; | ||
position: absolute; | ||
z-index: 999; | ||
height: 50rem; | ||
${(props) => { | ||
if (props.left) { | ||
return `left: 0;`; | ||
} | ||
return `right: 0;`; | ||
}} | ||
border-radius: ${(props) => props.border[0]}rem | ||
${(props) => props.border[1]}rem ${(props) => props.border[2]}rem | ||
${(props) => props.border[3]}rem; | ||
margin-left: ${(props) => props.margin}rem; | ||
`; | ||
|
||
const Button = styled.button<Props>` | ||
cursor: pointer; | ||
color: white; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: rgba(255, 255, 255, 0.3); | ||
user-select: none; | ||
width: 10rem; | ||
position: absolute; | ||
z-index: 999; | ||
height: 50rem; | ||
${(props) => { | ||
if (props.left) { | ||
return `left: 0;`; | ||
} | ||
return `right: 0;`; | ||
}} | ||
border-radius: ${(props) => props.border[0]}rem | ||
${(props) => props.border[1]}rem ${(props) => props.border[2]}rem | ||
${(props) => props.border[3]}rem; | ||
margin-left: ${(props) => props.margin}rem; | ||
`; | ||
|
||
export function LeftArrow() { | ||
const { scrollPrev } = React.useContext(VisibilityContext); | ||
return <Left onClick={() => scrollPrev()}>←</Left>; | ||
} | ||
|
||
export function RightArrow() { | ||
const { scrollNext } = React.useContext(VisibilityContext); | ||
return <Right onClick={() => scrollNext()}>→</Right>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { VisibilityContext } from 'react-horizontal-scrolling-menu'; | ||
|
||
export function Card({ title, itemId }: { title: string; itemId: string }) { | ||
const visibility = React.useContext(VisibilityContext); | ||
const visible = visibility.isItemVisible(title); | ||
|
||
return ( | ||
<CardContainer> | ||
<div> | ||
<div style={{ backgroundColor: 'white' }}>block{itemId}</div> | ||
<div style={{ backgroundColor: visible ? 'transparent' : 'gray' }}> | ||
visible: {JSON.stringify(visible)} | ||
</div> | ||
</div> | ||
<div | ||
style={{ | ||
backgroundColor: 'bisque', | ||
height: '200px', | ||
}} | ||
/> | ||
</CardContainer> | ||
); | ||
} | ||
|
||
const CardContainer = styled.div` | ||
border: 1px solid; | ||
display: inline-block; | ||
margin: 0 10px; | ||
width: 160px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ export default interface blockInterface { | |
title: string; | ||
detail: string; | ||
tags: string[]; | ||
itemId: string; | ||
} |
76a4264
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.
@haryung-lee is attempting to deploy a commit to a Personal Account on Vercel that is not owned by them.
In order for the commit to be deployed, @haryung-lee must be granted access to the connected Vercel project.
If you're the owner of the Personal Account, transfer the project to a Vercel Team and start collaborating, or learn more.