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 224
feat: add tab switch to hide pages and sidebar #560
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d5ba8b
feat: add tab switch to hide pages and sidebar
tilmx 2e386d8
fix: remove underline
tilmx 81e33bf
fix: use enum for tab switch state
tilmx 0d7a48a
fix: use color variable for startup background
tilmx 1330bb0
fix: install color module
tilmx 69955de
Merge branch 'master' into feat/add-tab-switch
marionebl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,40 @@ | ||
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?: boolean; | ||
icon?: IconName; | ||
label?: string; | ||
onClick?: React.MouseEventHandler<HTMLElement>; | ||
title: string; | ||
} | ||
|
||
const StyledTabSwitch = styled.div` | ||
display: flex; | ||
box-sizing: border-box; | ||
padding: 0 ${getSpace(SpaceSize.XS)}px; | ||
color: ${(props: TabSwitchProps) => (props.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 } 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()} | ||
onClick={() => store.setShowPages(!store.getShowPages())} | ||
/> | ||
<TabSwitch | ||
icon={IconName.Element} | ||
title={'Elements & Library'} | ||
active={store.getShowLeftSidebar()} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import * as Analyzer from '../analyzer'; | ||
import { checkForUpdates } from './auto-updater'; | ||
import { Color } from '../components'; | ||
import { createCompiler } from '../compiler/create-compiler'; | ||
import { app, BrowserWindow, dialog, screen, shell } from 'electron'; | ||
import * as electronIsDev from 'electron-is-dev'; | ||
|
@@ -508,7 +507,7 @@ async function createWindow(): Promise<void> { | |
minWidth: 780, | ||
minHeight: 380, | ||
titleBarStyle: 'hiddenInset', | ||
backgroundColor: Color.Grey97, | ||
backgroundColor: '#f7f7f7', | ||
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. Some special reason for this one? 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. Color.Grey97 didn’t work (I guess because electron only allows hex values) 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. Ah, so lets use the |
||
title: 'Alva' | ||
}); | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let's use an required enum instead:
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.
Did that!