Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

feat: move page overview to sidebar #554

Merged
merged 24 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3b5cd52
fix: rename preview-tile to page-tile
tilmx Jun 11, 2018
c12750b
feat: move pages to left sidebar
tilmx Jun 11, 2018
5d2993c
feat: update styling of page tile
tilmx Jun 11, 2018
17ff74f
feat: update styling of add page button
tilmx Jun 11, 2018
6c437ac
fix: remove unneeded page view code
tilmx Jun 11, 2018
20a0a83
fix: set app focus on page or element selection
tilmx Jun 11, 2018
2c00624
fix: don’t remove last page
tilmx Jun 11, 2018
33bdd3b
feat: introduce element and page focus state
tilmx Jun 11, 2018
19462ad
fix: use focus-item object to handle type
tilmx Jun 11, 2018
0c4f6f3
feat: add focus styling for page tile
tilmx Jun 11, 2018
3aaa5b0
feat: add focused state to elements
tilmx Jun 11, 2018
6010aba
fix: update styling of focused page tile
tilmx Jun 12, 2018
27efff0
fix: fix minor styling fixes
tilmx Jun 12, 2018
c4edb35
feat: add option to hide page sidebar
tilmx Jun 12, 2018
83fe3b3
fix: set focused item on project open
tilmx Jun 12, 2018
3c0043b
fix: make root element not editable
tilmx Jun 12, 2018
823ba83
fix: show default cursor on non-editable elements
tilmx Jun 12, 2018
5a25ec6
fix: update add button demo
tilmx Jun 12, 2018
e7d1b25
fix: rename add page to add page button
tilmx Jun 12, 2018
a3a5e99
fix: remove unneeded code
tilmx Jun 12, 2018
bc333bf
fix: update menu item names
tilmx Jun 13, 2018
1845e96
fix: use capabilities for elements
tilmx Jun 13, 2018
5ff6d4a
Merge branch 'master' into feat/update-page-styling
tilmx Jun 13, 2018
069db02
fix: solve merge conflict
tilmx Jun 13, 2018
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
11 changes: 11 additions & 0 deletions src/components/add-page-button/demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import DemoContainer from '../demo-container';
import * as React from 'react';
import { AddPageButton } from '.';

const AddPageButtonDemo: React.StatelessComponent = (): JSX.Element => (
<DemoContainer title="Add Page Button">
<AddPageButton />
</DemoContainer>
);

export default AddPageButtonDemo;
45 changes: 45 additions & 0 deletions src/components/add-page-button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as React from 'react';
import { Color } from '../colors';
import { Copy } from '../copy';
import { getSpace, SpaceSize } from '../space';
import { Icon, IconName, IconSize } from '../icons';
import styled from 'styled-components';

export interface AddPageButtonProps {
onClick?: React.MouseEventHandler<HTMLElement>;
}

const StyledAddPageButton = styled.button`
position: relative;
box-sizing: border-box;
height: 60px;
width: 100%;
border: 1px solid ${Color.Grey80};
border-radius: 6px;
background-color: transparent;
margin: ${getSpace(SpaceSize.S)}px;
display: flex;
align-items: center;
justify-content: center;
transition: border 0.2s;
user-select: none;

&:focus {
outline: none;
}

&:hover {
border: 1px solid ${Color.Grey60};
}
`;

const StyledIcon = styled(Icon)`
margin-right: ${getSpace(SpaceSize.XS)}px;
`;

export const AddPageButton: React.SFC<AddPageButtonProps> = props => (
<StyledAddPageButton onClick={props.onClick}>
<StyledIcon name={IconName.Plus} size={IconSize.XS} color={Color.Grey60} />
<Copy textColor={Color.Grey50}>Add Page</Copy>
</StyledAddPageButton>
);
8 changes: 8 additions & 0 deletions src/components/add-page-button/pattern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "add-page-button",
"description": "Button to add pages",
"displayName": "Add Page Button",
"version": "1.0.0",
"tags": ["atom", "button"],
"flag": "alpha"
}
1 change: 1 addition & 0 deletions src/components/colors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum Color {
BlueAlpha40 = 'rgba(0, 112, 214, .4)',
Blue20 = 'rgb(51, 141, 222)',
Blue40 = 'rgb(102, 169, 230)',
Blue60 = 'rgb(153, 198, 239)',
Blue80 = 'rgb(212, 226, 242)',
Green = 'rgb(91, 226, 122)',
Grey20 = 'rgb(52, 61, 69)',
Expand Down
29 changes: 10 additions & 19 deletions src/components/element/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DemoContainer from '../demo-container';
import { Element, ElementState } from './index';
import { Element, ElementCapability, ElementState } from './index';
import * as React from 'react';

// tslint:disable-next-line:no-empty
Expand All @@ -9,8 +9,7 @@ const CHILD = (
<Element
id="1"
state={ElementState.Default}
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
title="Child Element"
Expand All @@ -25,8 +24,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
<Element
id="1"
state={ElementState.Default}
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
title="Element"
Expand All @@ -37,8 +35,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
Active
<Element
id="2"
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
state={ElementState.Active}
Expand All @@ -50,8 +47,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
Highlighted
<Element
id="2"
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
state={ElementState.Highlighted}
Expand All @@ -63,8 +59,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
Placeholder Highlighted
<Element
id="2"
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
placeholderHighlighted={true}
Expand All @@ -77,8 +72,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
Editable
<Element
id="2"
draggable={false}
mayOpen={false}
capabilities={[ElementCapability.Editable]}
open={false}
onChange={NOOP}
state={ElementState.Editable}
Expand All @@ -90,8 +84,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
May open, closed
<Element
id="3"
draggable={false}
mayOpen={true}
capabilities={[ElementCapability.Editable, ElementCapability.Openable]}
onChange={NOOP}
open={false}
title="Element"
Expand All @@ -105,8 +98,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
May open, opened
<Element
id="3"
draggable={false}
mayOpen={true}
capabilities={[ElementCapability.Editable, ElementCapability.Openable]}
onChange={NOOP}
open
title="Element"
Expand All @@ -120,8 +112,7 @@ const ElementDemo: React.StatelessComponent<void> = (): JSX.Element => (
With child, active and open
<Element
id="4"
draggable={false}
mayOpen={true}
capabilities={[ElementCapability.Editable, ElementCapability.Openable]}
onChange={NOOP}
open
title="Element"
Expand Down
27 changes: 20 additions & 7 deletions src/components/element/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ export enum ElementState {
Editable = 'editable',
Active = 'active',
Disabled = 'disabled',
Highlighted = 'highlighted'
Highlighted = 'highlighted',
Focused = 'focused'
}

export enum ElementCapability {
Draggable = 'draggable',
Editable = 'editable',
Openable = 'openable'
}

export interface ElementProps {
capabilities: ElementCapability[];
children?: React.ReactNode;
draggable: boolean;
dragging: boolean;
id: string;
mayOpen: boolean;
onChange: React.FormEventHandler<HTMLInputElement>;
open: boolean;
placeholderHighlighted?: boolean;
Expand All @@ -45,6 +51,7 @@ interface StyledIconProps {

interface LabelContentProps {
active: boolean;
editable?: boolean;
}

export interface StyledElementChildProps {
Expand Down Expand Up @@ -178,7 +185,8 @@ const LabelContent = styled.div`
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
cursor: ${(props: LabelContentProps) => (props.active ? 'text' : 'default')};
cursor: ${(props: LabelContentProps) => (props.active && props.editable ? 'text' : 'default')};
user-select: none;
`;

const StyledSeamlessInput = styled.input`
Expand Down Expand Up @@ -227,15 +235,18 @@ class SeamlessInput extends React.Component<SeamlessInputProps> {
}

export const Element: React.StatelessComponent<ElementProps> = props => (
<StyledElement {...{ [ElementAnchors.element]: props.id }} draggable={props.draggable}>
<StyledElement
{...{ [ElementAnchors.element]: props.id }}
draggable={props.capabilities.includes(ElementCapability.Draggable)}
>
{props.dragging && (
<StyledPlaceholder
{...{ [ElementAnchors.placeholder]: true }}
visible={Boolean(props.placeholderHighlighted)}
/>
)}
<StyledElementLabel state={props.state}>
{props.mayOpen && (
{props.capabilities.includes(ElementCapability.Openable) && (
<StyledIcon
dataIcon={props.id}
name={IconName.ArrowFillRight}
Expand All @@ -245,7 +256,8 @@ export const Element: React.StatelessComponent<ElementProps> = props => (
active={props.state === ElementState.Active}
/>
)}
{props.state === ElementState.Editable ? (
{props.state === ElementState.Editable &&
props.capabilities.includes(ElementCapability.Editable) ? (
<SeamlessInput
{...{ [ElementAnchors.label]: true }}
value={props.title}
Expand All @@ -256,6 +268,7 @@ export const Element: React.StatelessComponent<ElementProps> = props => (
) : (
<LabelContent
active={props.state === ElementState.Active}
editable={props.capabilities.includes(ElementCapability.Editable)}
{...{ [ElementAnchors.label]: true }}
>
{props.title}
Expand Down
12 changes: 0 additions & 12 deletions src/components/floating-button/demo.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/components/floating-button/index.md

This file was deleted.

58 changes: 0 additions & 58 deletions src/components/floating-button/index.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions src/components/floating-button/pattern.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export * from './add-page-button';
export * from './bug-report';
export * from './button';
export * from './chrome';
export * from './colors';
export * from './copy';
export * from './create-select';
export * from './element';
export * from './floating-button';
export * from './fonts';
export * from './global-styles';
export * from './headline';
Expand All @@ -15,9 +15,9 @@ export * from './layout';
export * from './link';
export * from './list';
export * from './overlay';
export * from './page-tile';
export * from './panes';
export * from './pattern-list';
export * from './preview-tile';
export * from './property-input';
export * from './property-item';
export * from './property-item-asset';
Expand Down
Loading