Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork54
Mock Browser#168
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:staging
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Mock Browser#168
Changes from1 commit
7b4d1c86cc4ca3f40aa140868cedc1fbac29cb81354f58c4bbaf76226b7058a50b30e597c8c3338a1d4c9575cd14ad55b666f7cdb9d94a2f48f42c14cf03161e970d92f809f8cc394dabcef2a9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { Meta, Story, Preview, Props } from "@storybook/addon-docs/blocks"; | ||
| import { | ||
| BrowserNavigationBfButton, | ||
| BrowserNavigationBfButtonGroup, | ||
| } from "./browser-navigation-bf-button-group"; | ||
| <Meta title="component/browser-navigation-bf-button-group" /> | ||
| # Preview | ||
| <Preview> | ||
| <Story name="forward"> | ||
| <BrowserNavigationBfButton | ||
| hasHistory={true} | ||
| onClick={(isBack) => { | ||
| console.log(isBack); | ||
| }} | ||
| /> | ||
| </Story> | ||
| <Story name="back"> | ||
| <BrowserNavigationBfButton | ||
| isBack={true} | ||
| hasHistory={true} | ||
| onClick={(isBack) => { | ||
| console.log(isBack); | ||
| }} | ||
| /> | ||
| </Story> | ||
| <Story name="no history"> | ||
| <BrowserNavigationBfButton | ||
| isBack={false} | ||
| hasHistory={false} | ||
| onClick={(isBack) => { | ||
| console.log(isBack); | ||
| }} | ||
| /> | ||
| <BrowserNavigationBfButton | ||
| isBack={true} | ||
| hasHistory={false} | ||
| onClick={(isBack) => { | ||
| console.log(isBack); | ||
| }} | ||
| /> | ||
| </Story> | ||
| <Story name="group"> | ||
| <BrowserNavigationBfButtonGroup | ||
| forwardEnable={true} | ||
| backEnable={true} | ||
| handleClick={(isBack) => { | ||
| console.log(isBack); | ||
| }} | ||
| /> | ||
| </Story> | ||
| </Preview> | ||
| # Props |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| import React from "react"; | ||
| import styled from "@emotion/styled"; | ||
| import { css } from "@emotion/react"; | ||
| import ForwardArrowIcon from "./icon/forward-arrow"; | ||
| interface ButtonGroupProps { | ||
| forwardEnable?: boolean; | ||
| backEnable?: boolean; | ||
| handleClick: (isBack: boolean) => void; | ||
| } | ||
| interface BrowserNavigationBfButtonProps { | ||
| isBack?: boolean; | ||
| hasHistory: boolean; | ||
| onClick?: (isBack: boolean) => void; | ||
| } | ||
| export function BrowserNavigationBfButton( | ||
| props?: BrowserNavigationBfButtonProps | ||
| ) { | ||
| console.log(props.hasHistory); | ||
| return ( | ||
| <BtnWrap | ||
| onClick={() => props.onClick(!!props.isBack)} | ||
| isShow={!props.hasHistory} | ||
| disabled={!props.hasHistory} | ||
| > | ||
| <ArrowIconWrap isBack={props.isBack}> | ||
| <ForwardArrowIcon /> | ||
| </ArrowIconWrap> | ||
| </BtnWrap> | ||
| ); | ||
| } | ||
| export function BrowserNavigationBfButtonGroup(props: ButtonGroupProps) { | ||
| return ( | ||
| <Wrap> | ||
| <BrowserNavigationBfButton | ||
| onClick={() => props.handleClick(true)} | ||
| hasHistory={props.backEnable} | ||
| isBack={true} | ||
| /> | ||
| <BrowserNavigationBfButton | ||
| onClick={() => props.handleClick(false)} | ||
| hasHistory={props.forwardEnable} | ||
| /> | ||
| </Wrap> | ||
| ); | ||
| } | ||
| const Wrap = styled.div` | ||
| justify-content: flex-start; | ||
| flex-direction: row; | ||
| align-items: start; | ||
| flex: none; | ||
| button { | ||
| &:first-child { | ||
| margin-right: 6px; | ||
| } | ||
| } | ||
| `; | ||
| const BtnWrap = styled.button<{ isShow: boolean }>` | ||
| /* clear button origin style */ | ||
| border: 0; | ||
| padding: 0; | ||
| position: relative; | ||
| width: 28px; | ||
| height: 24px; | ||
| border-radius: 4px; | ||
| background-color: transparent; | ||
| ${(props) => | ||
| props.isShow | ||
| ? css` | ||
| cursor: default; | ||
| opacity: 0; | ||
| ` | ||
| : css` | ||
| cursor: pointer; | ||
| `} | ||
| &:hover { | ||
| background-color: rgba(242, 242, 242, 1); | ||
| border-radius: 4px; | ||
| } | ||
| `; | ||
| const ArrowIconWrap = styled.span<{ isBack?: boolean }>` | ||
| position: absolute; | ||
| left: calc(50% - 8px); | ||
| top: calc(50% - 8px); | ||
| transform: ${(props) => (props.isBack ? "rotate(180deg)" : "rotate(0deg)")}; | ||
| & > svg { | ||
| display: block; | ||
| } | ||
| `; |
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.