-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Sidebar): handle clicks properly
- Loading branch information
1 parent
a4b8757
commit 6ccfaa0
Showing
47 changed files
with
338 additions
and
1,060 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
58 changes: 0 additions & 58 deletions
58
docs/src/examples/addons/Ref/Types/RefForwardingExample.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
138 changes: 57 additions & 81 deletions
138
docs/src/examples/modules/Sidebar/Examples/SidebarExampleMultiple.js
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,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 |
Oops, something went wrong.