-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Sticky): disable styles when
active
is false (#2083)
- Loading branch information
1 parent
e2fc8f5
commit 5fbba00
Showing
4 changed files
with
82 additions
and
27 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
docs/app/Examples/modules/Sticky/Variations/StickyExampleActive.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import _ from 'lodash' | ||
import React, { Component } from 'react' | ||
import { Checkbox, Grid, Header, Image, Rail, Segment, Sticky } from 'semantic-ui-react' | ||
|
||
const Placeholder = () => <Image src='/assets/images/wireframe/paragraph.png' /> | ||
|
||
export default class StickyPushingExample extends Component { | ||
state = { active: true } | ||
|
||
handleContextRef = contextRef => this.setState({ contextRef }) | ||
|
||
handleToggle = () => this.setState({ active: !this.state.active }) | ||
|
||
render() { | ||
const { active, contextRef } = this.state | ||
|
||
return ( | ||
<Grid centered columns={3}> | ||
<Grid.Column> | ||
<div ref={this.handleContextRef}> | ||
<Segment> | ||
{_.times(10, i => <Placeholder key={i} />)} | ||
|
||
<Rail position='left'> | ||
<Sticky context={contextRef}> | ||
<Segment> | ||
<Checkbox | ||
checked={active} | ||
label='Activate Sticky on right' | ||
onChange={this.handleToggle} | ||
toggle | ||
/> | ||
</Segment> | ||
</Sticky> | ||
</Rail> | ||
|
||
<Rail position='right'> | ||
<Sticky active={active} context={contextRef}> | ||
<Header as='h3'>Stuck Content</Header> | ||
<Image src='/assets/images/wireframe/image.png' /> | ||
</Sticky> | ||
</Rail> | ||
</Segment> | ||
</div> | ||
</Grid.Column> | ||
</Grid> | ||
) | ||
} | ||
} |
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
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
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