Skip to content

Commit

Permalink
Added tests and docs for toolbar nav
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Aug 8, 2016
1 parent aed6c86 commit aad6c86
Show file tree
Hide file tree
Showing 18 changed files with 305 additions and 83 deletions.
30 changes: 19 additions & 11 deletions docs/mac-os/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
background | string | Sets the background color of a component.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
label | string | Adds a label to the box.
margin | string | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
padding | string | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.
Property | Type | Description
:------------------ | :-------------:| :----------
background | string | Sets the background color of a component.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
label | string | Adds a label to the box.
margin | string, number | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
marginBottom | string, number | Sets the outer margin bottom of a component.
marginLeft | string, number | Sets the outer margin left of a component.
marginRight | string, number | Sets the outer margin right of a component.
marginTop | string, number | Sets the outer margin top of a component.
padding | string, number | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
paddingBottom | string, number | Sets the padding bottom inside a component.
paddingLeft | string, number | Sets the padding left inside a component.
paddingRight | string, number | Sets the padding right inside a component.
paddingTop | string, number | Sets the padding top inside a component.
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.

### Examples

Expand Down
28 changes: 18 additions & 10 deletions docs/mac-os/label.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
color | string | Sets the color of the text.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
margin | string | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
padding | string | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.
Property | Type | Description
:------------------ | :-------------:| :----------
color | string | Sets the color of the text.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
margin | string, number | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
marginBottom | string, number | Sets the outer margin bottom of a component.
marginLeft | string, number | Sets the outer margin left of a component.
marginRight | string, number | Sets the outer margin right of a component.
marginTop | string, number | Sets the outer margin top of a component.
padding | string, number | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
paddingBottom | string, number | Sets the padding bottom inside a component.
paddingLeft | string, number | Sets the padding left inside a component.
paddingRight | string, number | Sets the padding right inside a component.
paddingTop | string, number | Sets the padding top inside a component.
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.

### Examples

Expand Down
18 changes: 11 additions & 7 deletions docs/mac-os/segmented-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
box | bool | Sets whether the item is in a box or not.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
margin | string | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
width | number | Sets the width of a component.
Property | Type | Description
:------------------ | :-------------:| :----------
box | bool | Sets whether the item is in a box or not.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
margin | string, number | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
marginBottom | string, number | Sets the outer margin bottom of a component.
marginLeft | string, number | Sets the outer margin left of a component.
marginRight | string, number | Sets the outer margin right of a component.
marginTop | string, number | Sets the outer margin top of a component.
width | number | Sets the width of a component.

## SegmentedControlItem

Expand Down
1 change: 1 addition & 0 deletions docs/mac-os/title-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Property | Type | Description
:------------------ | :-----------:| :----------
controls | bool | Sets the visibility of the controls of the title bar.
inset | bool | Sets the controls of the title bar state to be inset.
isFullscreen | bool | Sets the title bar state to fullscreen.
onCloseClick | function | Callback function of the close button.
onMaximizeClick | function | Callback function of the maximize button
Expand Down
82 changes: 82 additions & 0 deletions docs/mac-os/toolbar-nav.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Toolbar Nav

## ToolbarNav

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
height | number | Sets the height of a component.
width | number | Sets the width of a component.

## ToolbarNavItem

### Properties

Property | Type | Description
:------------------ | :---------------------:| :----------
icon | element, array | Sets the icon element of the item.
onClick | function | Callback function when the item is pressed.
selected | bool | Sets whether the item is selected or not.
title | string | Sets the title of the item.

### Examples

```jsx
import React, { Component } from 'react';
import { TitleBar, Toolbar, ToolbarNav, ToolbarNavItem } from 'react-desktop/macOs';

const circle = (
<svg x="0px" y="0px" width="25px" height="25px" viewBox="0 0 25 25">
<circle cx="12.5" cy="12.5" r="12.5"/>
</svg>
);

const star = (
<svg x="0px" y="0px" width="25px" height="23.8px" viewBox="0 0 25 23.8">
<polygon points="12.5,0 16.4,7.8 25,9.1 18.8,15.2 20.2,23.8 12.5,19.7 4.8,23.8 6.2,15.2 0,9.1 8.6,7.8 "/>
</svg>
);

const polygon = (
<svg x="0px" y="0px" width="25px" height="21.7px" viewBox="0 0 25 21.7">
<polygon points="6.2,21.7 0,10.8 6.2,0 18.8,0 25,10.8 18.8,21.7 "/>
</svg>
);

export default class extends Component {
constructor() {
super();
this.state = { selected: 1 };
}

render() {
return (
<TitleBar>
<Toolbar>
<ToolbarNav>
<ToolbarNavItem
title="Item 1"
icon={circle}
selected={this.state.selected === 1}
onClick={() => this.setState({ selected: 1 })}
/>
<ToolbarNavItem
title="Item 2"
icon={star}
selected={this.state.selected === 2}
onClick={() => this.setState({ selected: 2 })}
/>
<ToolbarNavItem
title="Item 3"
icon={polygon}
selected={this.state.selected === 3}
onClick={() => this.setState({ selected: 3 })}
/>
</ToolbarNav>
</Toolbar>
</TitleBar>
);
}
}
```
18 changes: 12 additions & 6 deletions docs/mac-os/toolbar.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Toolbar

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
height | number | Sets the height of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.

### Examples

```jsx
import React, { Component } from 'react';
import { TitleBar, Toolbar } from 'react-desktop/macOs';
import { TitleBar, Toolbar, Text } from 'react-desktop/macOs';

export default class extends Component {
render() {
return (
<TitleBar
title="Large Titlebar"
controls
>
<Toolbar/>
<TitleBar controls inset>
<Toolbar height="43" horizontalAlignment="center"/>
</TitleBar>
);
}
Expand Down
30 changes: 19 additions & 11 deletions docs/mac-os/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
background | string | Sets the background color of a component.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
layout | string | Sets the direction of the content.<br/>__Property value__ _"horizontal"_, _"vertical"_
margin | string | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
padding | string | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.
Property | Type | Description
:------------------ | :-------------:| :----------
background | string | Sets the background color of a component.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
layout | string | Sets the direction of the content.<br/>__Property value__ _"horizontal"_, _"vertical"_
margin | string, number | Sets the outer margin of a component.<br/>__E.G.__ _"30px 20px"_
marginBottom | string, number | Sets the outer margin bottom of a component.
marginLeft | string, number | Sets the outer margin left of a component.
marginRight | string, number | Sets the outer margin right of a component.
marginTop | string, number | Sets the outer margin top of a component.
padding | string, number | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
paddingBottom | string, number | Sets the padding bottom inside a component.
paddingLeft | string, number | Sets the padding left inside a component.
paddingRight | string, number | Sets the padding right inside a component.
paddingTop | string, number | Sets the padding top inside a component.
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.

### Examples

Expand Down
24 changes: 14 additions & 10 deletions docs/mac-os/window.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@

### Properties

Property | Type | Description
:------------------ | :-----------:| :----------
background | string | Sets the background color of a component.
chrome | bool | Sets the chrome of the window.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
padding | string | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.
Property | Type | Description
:------------------ | :-------------:| :----------
background | string | Sets the background color of a component.
chrome | bool | Sets the chrome of the window.
height | number | Sets the height of a component.
hidden | bool | Sets the visibility of a component.
horizontalAlignment | string | Sets the horizontal alignment of the component's content<br/>__Property value__ _"left"_, _"center"_, _"right"_
padding | string, number | Sets the padding inside a component.<br/>__E.G.__ _"30px 20px"_
paddingBottom | string, number | Sets the padding bottom inside a component.
paddingLeft | string, number | Sets the padding left inside a component.
paddingRight | string, number | Sets the padding right inside a component.
paddingTop | string, number | Sets the padding top inside a component.
verticalAlignment | string | Sets the vertical alignment of the component's content.<br/>__Property value__ _"top"_, _"center"_, _"bottom"_
width | number | Sets the width of a component.

### Examples

Expand Down
9 changes: 3 additions & 6 deletions examples/macOs/components/toolbar.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React, { Component } from 'react';
import { TitleBar, Toolbar } from 'react-desktop/macOs';
import { TitleBar, Toolbar, Text } from 'react-desktop/macOs';

export default class extends Component {
render() {
return (
<TitleBar
title="Large Titlebar"
controls
>
<Toolbar/>
<TitleBar controls inset>
<Toolbar height="43" horizontalAlignment="center"/>
</TitleBar>
);
}
Expand Down
56 changes: 56 additions & 0 deletions examples/macOs/components/toolbarNav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, { Component } from 'react';
import { TitleBar, Toolbar, ToolbarNav, ToolbarNavItem } from 'react-desktop/macOs';

const circle = (
<svg x="0px" y="0px" width="25px" height="25px" viewBox="0 0 25 25">
<circle cx="12.5" cy="12.5" r="12.5"/>
</svg>
);

const star = (
<svg x="0px" y="0px" width="25px" height="23.8px" viewBox="0 0 25 23.8">
<polygon points="12.5,0 16.4,7.8 25,9.1 18.8,15.2 20.2,23.8 12.5,19.7 4.8,23.8 6.2,15.2 0,9.1 8.6,7.8 "/>
</svg>
);

const polygon = (
<svg x="0px" y="0px" width="25px" height="21.7px" viewBox="0 0 25 21.7">
<polygon points="6.2,21.7 0,10.8 6.2,0 18.8,0 25,10.8 18.8,21.7 "/>
</svg>
);

export default class extends Component {
constructor() {
super();
this.state = { selected: 1 };
}

render() {
return (
<TitleBar>
<Toolbar>
<ToolbarNav>
<ToolbarNavItem
title="Item 1"
icon={circle}
selected={this.state.selected === 1}
onClick={() => this.setState({ selected: 1 })}
/>
<ToolbarNavItem
title="Item 2"
icon={star}
selected={this.state.selected === 2}
onClick={() => this.setState({ selected: 2 })}
/>
<ToolbarNavItem
title="Item 3"
icon={polygon}
selected={this.state.selected === 3}
onClick={() => this.setState({ selected: 3 })}
/>
</ToolbarNav>
</Toolbar>
</TitleBar>
);
}
}
Loading

0 comments on commit aad6c86

Please sign in to comment.