This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tab switch to hide pages and sidebar (#560)
* feat: add tab switch to hide pages and sidebar * fix: remove underline * fix: use enum for tab switch state * fix: use color variable for startup background * fix: install color module
- Loading branch information
Showing
15 changed files
with
3,293 additions
and
3,202 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 @@ | ||
export * from './tab-switch'; |
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,8 @@ | ||
{ | ||
"name": "tab-switch", | ||
"displayName": "Tab Switch", | ||
"description": "Tab to switch between Views", | ||
"version": "1.0.0", | ||
"tags": ["tab", "switch"], | ||
"flag": "alpha" | ||
} |
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,46 @@ | ||
import { Color } from '../colors'; | ||
import { Copy } from '../copy'; | ||
import { Icon, IconName, IconSize } from '../icons'; | ||
import * as React from 'react'; | ||
import { getSpace, SpaceSize } from '../space'; | ||
import styled from 'styled-components'; | ||
|
||
export interface TabSwitchProps { | ||
active?: TabSwitchState; | ||
icon?: IconName; | ||
label?: string; | ||
onClick?: React.MouseEventHandler<HTMLElement>; | ||
title: string; | ||
} | ||
|
||
export enum TabSwitchState { | ||
Active, | ||
Default | ||
} | ||
|
||
const StyledTabSwitch = styled.div` | ||
display: flex; | ||
box-sizing: border-box; | ||
padding: 0 ${getSpace(SpaceSize.XS)}px; | ||
color: ${(props: TabSwitchProps) => | ||
props.active === TabSwitchState.Active ? Color.Blue : Color.Grey50}; | ||
height: 100%; | ||
align-items: center; | ||
&:active { | ||
color: ${Color.Grey20}; | ||
} | ||
`; | ||
|
||
export const TabSwitch: React.SFC<TabSwitchProps> = props => ( | ||
<StyledTabSwitch | ||
active={props.active} | ||
icon={props.icon} | ||
label={props.label} | ||
onClick={props.onClick} | ||
title={props.title} | ||
> | ||
{props.icon && <Icon name={props.icon} size={IconSize.S} />} | ||
{props.label && <Copy>{props.label}</Copy>} | ||
</StyledTabSwitch> | ||
); |
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
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,30 @@ | ||
import { IconName, TabSwitchState } from '../../components'; | ||
import * as MobxReact from 'mobx-react'; | ||
import * as React from 'react'; | ||
import { TabSwitch } from '../../components'; | ||
import { ViewStore } from '../../store'; | ||
|
||
@MobxReact.inject('store') | ||
@MobxReact.observer | ||
export class ChromeSwitch extends React.Component { | ||
public render(): JSX.Element | null { | ||
const { store } = this.props as { store: ViewStore }; | ||
|
||
return ( | ||
<div style={{ display: 'flex', height: '100%' }}> | ||
<TabSwitch | ||
icon={IconName.Page} | ||
title={'Pages'} | ||
active={store.getShowPages() ? TabSwitchState.Active : TabSwitchState.Default} | ||
onClick={() => store.setShowPages(!store.getShowPages())} | ||
/> | ||
<TabSwitch | ||
icon={IconName.Element} | ||
title={'Elements & Library'} | ||
active={store.getShowLeftSidebar() ? TabSwitchState.Active : TabSwitchState.Default} | ||
onClick={() => store.setShowLeftSidebar(!store.getShowLeftSidebar())} | ||
/> | ||
</div> | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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