Skip to content

Commit

Permalink
fix(Sidebar): handle clicks properly
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter committed Sep 6, 2019
1 parent a4b8757 commit 6ccfaa0
Show file tree
Hide file tree
Showing 47 changed files with 338 additions and 1,060 deletions.
72 changes: 0 additions & 72 deletions docs/src/examples/addons/Ref/Types/RefExampleRef.js

This file was deleted.

58 changes: 0 additions & 58 deletions docs/src/examples/addons/Ref/Types/RefForwardingExample.js

This file was deleted.

30 changes: 0 additions & 30 deletions docs/src/examples/addons/Ref/Types/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions docs/src/examples/addons/Ref/index.js

This file was deleted.

138 changes: 57 additions & 81 deletions docs/src/examples/modules/Sidebar/Examples/SidebarExampleMultiple.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,62 @@
import React, { Component } from 'react'
import {
Button,
Header,
Icon,
Image,
Menu,
Segment,
Sidebar,
} from 'semantic-ui-react'
import { useBooleanKnob } from '@stardust-ui/docs-components'
import React from 'react'
import { Header, Icon, Image, Menu, Segment, Sidebar } from 'semantic-ui-react'

export default class SidebarExampleMultiple extends Component {
state = { visible: false }
const SidebarExampleMultiple = () => {
const [visible, setVisible] = useBooleanKnob({ name: 'visible' })

handleHideClick = () => this.setState({ visible: false })
handleShowClick = () => this.setState({ visible: true })
handleSidebarHide = () => this.setState({ visible: false })
return (
<Sidebar.Pushable as={Segment}>
<Sidebar
as={Menu}
animation='overlay'
direction='left'
icon='labeled'
inverted
onHide={() => setVisible(false)}
vertical
visible={visible}
width='thin'
>
<Menu.Item as='a'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item as='a'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item as='a'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>

render() {
const { visible } = this.state
<Sidebar
as={Menu}
animation='overlay'
direction='right'
inverted
vertical
visible={visible}
>
<Menu.Item as='a' header>
File Permissions
</Menu.Item>
<Menu.Item as='a'>Share on Social</Menu.Item>
<Menu.Item as='a'>Share by E-mail</Menu.Item>
<Menu.Item as='a'>Edit Permissions</Menu.Item>
<Menu.Item as='a'>Delete Permanently</Menu.Item>
</Sidebar>

return (
<div>
<Button.Group>
<Button disabled={visible} onClick={this.handleShowClick}>
Show sidebars
</Button>
<Button disabled={!visible} onClick={this.handleHideClick}>
Hide sidebars
</Button>
</Button.Group>

<Sidebar.Pushable as={Segment}>
<Sidebar
as={Menu}
animation='overlay'
direction='left'
icon='labeled'
inverted
onHide={this.handleSidebarHide}
vertical
visible={visible}
width='thin'
>
<Menu.Item as='a'>
<Icon name='home' />
Home
</Menu.Item>
<Menu.Item as='a'>
<Icon name='gamepad' />
Games
</Menu.Item>
<Menu.Item as='a'>
<Icon name='camera' />
Channels
</Menu.Item>
</Sidebar>

<Sidebar
as={Menu}
animation='overlay'
direction='right'
inverted
vertical
visible={visible}
>
<Menu.Item as='a' header>
File Permissions
</Menu.Item>
<Menu.Item as='a'>Share on Social</Menu.Item>
<Menu.Item as='a'>Share by E-mail</Menu.Item>
<Menu.Item as='a'>Edit Permissions</Menu.Item>
<Menu.Item as='a'>Delete Permanently</Menu.Item>
</Sidebar>

<Sidebar.Pusher>
<Segment basic>
<Header as='h3'>Application Content</Header>
<Image src='/images/wireframe/paragraph.png' />
</Segment>
</Sidebar.Pusher>
</Sidebar.Pushable>
</div>
)
}
<Sidebar.Pusher>
<Segment basic>
<Header as='h3'>Application Content</Header>
<Image src='/images/wireframe/paragraph.png' />
</Segment>
</Sidebar.Pusher>
</Sidebar.Pushable>
)
}

export default SidebarExampleMultiple
Loading

0 comments on commit 6ccfaa0

Please sign in to comment.