Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
You-J wants to merge22 commits intostaging
base:staging
Choose a base branch
Loading
from@ui/mock-browser
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
22 commits
Select commitHold shift + click to select a range
7b4d1c8
setup structure
You-JOct 9, 2021
6cc4ca3
update readme
You-JOct 9, 2021
f40aa14
set storybook for component
You-JOct 9, 2021
0868ced
update directory names
softmarshmallowOct 9, 2021
c1fbac2
add global show / hide navigation animation by preview scroll
softmarshmallowOct 9, 2021
9cb8135
adjust animation
softmarshmallowOct 9, 2021
4f58c4b
stash add component using storybook
You-JOct 9, 2021
baf7622
add scroll anim trigger to code area & add 2line tab under root nav app
softmarshmallowOct 9, 2021
6b7058a
shadow on only code preview screen
softmarshmallowOct 9, 2021
50b30e5
Merge pull request #167 from gridaco/app-navigation
softmarshmallowOct 9, 2021
97c8c33
update root scripts
softmarshmallowOct 9, 2021
38a1d4c
fix storybook issue
You-JOct 9, 2021
9575cd1
fix storybook emotion version issue
You-JOct 9, 2021
4ad55b6
add storybook root
You-JOct 9, 2021
66f7cdb
add refresh btn
You-JOct 9, 2021
9d94a2f
rename
You-JOct 9, 2021
48f42c1
add component index
You-JOct 9, 2021
4cf0316
add address bar
You-JOct 9, 2021
1e970d9
stash add browser bar
You-JOct 9, 2021
2f809f8
Merge branch '@ui/mock-browser' of https://github.com/gridaco/assista…
You-JOct 9, 2021
cc394da
stash add attr in browser-bar
You-JOct 10, 2021
bcef2a9
fix unconfirmed design invisible
You-JOct 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
rename
  • Loading branch information
@You-J
You-J committedOct 9, 2021
commit9d94a2f471e1df91b95d38c962ab3ace965e6483
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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;
}
`;
View file
Open in desktop

This file was deleted.

View file
Open in desktop

This file was deleted.


[8]ページ先頭

©2009-2025 Movatter.jp