Skip to content

Commit

Permalink
feat(Sidebar): add component examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fracmak committed Nov 20, 2016
1 parent 0d5b103 commit ecabd5f
Show file tree
Hide file tree
Showing 25 changed files with 933 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarBottomOverlay extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable' style={{ overflow: 'hidden' }}>
<Sidebar as={Menu} animation='overlay' direction='bottom' visible={visible} icon='labeled' inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarBottomOverlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarLeftOverlay extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable'>
<Sidebar as={Menu} animation='overlay' width='thin' visible={visible} icon='labeled' vertical inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarLeftOverlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarRightOverlay extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable'>
<Sidebar
as={Menu}
animation='overlay'
width='thin'
direction='right'
visible={visible}
icon='labeled'
vertical
inverted
>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarRightOverlay
39 changes: 39 additions & 0 deletions docs/app/Examples/collections/Sidebar/Overlay/SidebarTopOverlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarTopOverlay extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable' style={{ position: 'relative' }}>
<Sidebar as={Menu} animation='overlay' direction='top' visible={visible} icon='labeled' inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarTopOverlay
31 changes: 31 additions & 0 deletions docs/app/Examples/collections/Sidebar/Overlay/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react'

import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'

const SidebarVariationsExamples = () => (
<ExampleSection title='Overlay'>
<ComponentExample
title='Left Overlay'
description='Sidebar attached to the left of the pushable container overlayed on the pusher.'
examplePath='collections/Sidebar/Overlay/SidebarLeftOverlay'
/>
<ComponentExample
title='Right Overlay'
description='Sidebar attached to the right of the pushable container overlayed on the pusher.'
examplePath='collections/Sidebar/Overlay/SidebarRightOverlay'
/>
<ComponentExample
title='Top Overlay'
description='Sidebar attached to the top of the pushable container overlayed on the pusher.'
examplePath='collections/Sidebar/Overlay/SidebarTopOverlay'
/>
<ComponentExample
title='Bottom Overlay'
description='Sidebar attached to the bottom of the pushable container overlayed on the pusher.'
examplePath='collections/Sidebar/Overlay/SidebarBottomOverlay'
/>
</ExampleSection>
)

export default SidebarVariationsExamples
39 changes: 39 additions & 0 deletions docs/app/Examples/collections/Sidebar/Push/SidebarBottomPush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarBottomPush extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable' style={{ overflow: 'hidden' }}>
<Sidebar as={Menu} animation='push' direction='bottom' visible={visible} icon='labeled' inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarBottomPush
39 changes: 39 additions & 0 deletions docs/app/Examples/collections/Sidebar/Push/SidebarLeftPush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarLeftPush extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable'>
<Sidebar as={Menu} animation='push' width='thin' visible={visible} icon='labeled' vertical inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarLeftPush
48 changes: 48 additions & 0 deletions docs/app/Examples/collections/Sidebar/Push/SidebarRightPush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarRightPush extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable'>
<Sidebar
as={Menu}
animation='push'
width='thin'
direction='right'
visible={visible}
icon='labeled'
vertical
inverted
>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarRightPush
39 changes: 39 additions & 0 deletions docs/app/Examples/collections/Sidebar/Push/SidebarTopPush.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component } from 'react'
import { Sidebar, Button, Menu, Image, Icon, Header } from 'semantic-ui-react'

class SidebarTopPush extends Component {
state = { visible: false }

toggleVisibility = () => this.setState({ visible: !this.state.visible })

render() {
const { visible } = this.state
return (
<div>
<Button onClick={this.toggleVisibility}>Toggle Visibility</Button>
<div className='pushable' style={{ position: 'relative', overflow: 'hidden' }}>
<Sidebar as={Menu} animation='push' direction='top' visible={visible} icon='labeled' inverted>
<Menu.Item name='home'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item name='gamepad'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item name='camera'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>
<div className='pusher'>
<Header as='h3'>Application Content</Header>
<Image src='http://semantic-ui.com/images/wireframe/paragraph.png' />
</div>
</div>
</div>
)
}
}

export default SidebarTopPush
Loading

0 comments on commit ecabd5f

Please sign in to comment.