-
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.
Merge branch 'master' of https://github.com/Semantic-Org/Semantic-UI-…
…React into perf/visibility-raf # Conflicts: # src/behaviors/Visibility/Visibility.js # test/specs/behaviors/Visibility/Visibility-test.js
- Loading branch information
Showing
47 changed files
with
717 additions
and
259 deletions.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
docs/app/Components/ComponentDoc/ComponentExample/ComponentExampleTitle.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,40 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { Header, Label } from 'semantic-ui-react' | ||
|
||
import { pure } from 'docs/app/HOC' | ||
|
||
const titleStyle = { | ||
margin: 0, | ||
} | ||
const descriptionStyle = { | ||
maxWidth: '50rem', | ||
} | ||
|
||
const ComponentExampleTitle = ({ description, title, suiVersion }) => ( | ||
<div> | ||
{title && ( | ||
<Header as='h3' className='no-anchor' style={titleStyle}> | ||
{title} | ||
{suiVersion && ( | ||
<Label | ||
as='a' | ||
color='teal' | ||
content={suiVersion} | ||
size='tiny' | ||
title={`Available from Semantic UI ${suiVersion}`} | ||
/> | ||
)} | ||
</Header> | ||
)} | ||
{description && <p style={descriptionStyle}>{description}</p>} | ||
</div> | ||
) | ||
|
||
ComponentExampleTitle.propTypes = { | ||
description: PropTypes.node, | ||
title: PropTypes.node, | ||
suiVersion: PropTypes.string, | ||
} | ||
|
||
export default pure(ComponentExampleTitle) |
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,16 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
import ComponentExample from './ComponentExample' | ||
|
||
const ShorthandExample = ({ description, ...rest }) => <ComponentExample {...rest} description={description} /> | ||
|
||
ShorthandExample.propTypes = { | ||
description: PropTypes.node, | ||
} | ||
|
||
ShorthandExample.defaultProps = { | ||
description: 'You can do the same using shorthands.', | ||
} | ||
|
||
export default ShorthandExample |
66 changes: 0 additions & 66 deletions
66
docs/app/Examples/behaviors/Visibility/Settings/CallbackFrequencyExample.js
This file was deleted.
Oops, something went wrong.
63 changes: 0 additions & 63 deletions
63
docs/app/Examples/behaviors/Visibility/Settings/GroupedCallbacksExample.js
This file was deleted.
Oops, something went wrong.
79 changes: 79 additions & 0 deletions
79
docs/app/Examples/behaviors/Visibility/Settings/VisibilityExampleCallbackFrequency.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,79 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Checkbox, Divider, Grid, Label, Segment, Sticky, Visibility } from 'semantic-ui-react' | ||
|
||
import Wireframe from '../Wireframe' | ||
|
||
export default class VisibilityExampleCallbackFrequency extends Component { | ||
state = { | ||
continuous: false, | ||
log: [], | ||
logCount: 0, | ||
once: true, | ||
} | ||
|
||
handleContextRef = contextRef => this.setState({ contextRef }) | ||
|
||
updateLog = eventName => () => this.setState(({ | ||
log: [ | ||
`${new Date().toLocaleTimeString()}: ${eventName}`, | ||
...this.state.log, | ||
].slice(0, 20), | ||
logCount: this.state.logCount + 1, | ||
})) | ||
|
||
clearLog = () => this.setState({ log: [], logCount: 0 }) | ||
|
||
toggleOnce = () => this.setState({ once: !this.state.once }) | ||
|
||
toggleContinuous = () => this.setState({ continuous: !this.state.continuous }) | ||
|
||
render() { | ||
const { continuous, contextRef, log, logCount, once } = this.state | ||
|
||
return ( | ||
<div ref={this.handleContextRef}> | ||
<Grid columns={2}> | ||
<Grid.Column> | ||
<Visibility | ||
continuous={continuous} | ||
once={once} | ||
onTopVisible={this.updateLog('onTopVisible')} | ||
onTopPassed={this.updateLog('onTopPassed')} | ||
onBottomVisible={this.updateLog('onBottomVisible')} | ||
onBottomPassed={this.updateLog('onBottomPassed')} | ||
onTopVisibleReverse={this.updateLog('onTopVisibleReverse')} | ||
onTopPassedReverse={this.updateLog('onTopPassedReverse')} | ||
onBottomVisibleReverse={this.updateLog('onBottomVisibleReverse')} | ||
onBottomPassedReverse={this.updateLog('onBottomPassedReverse')} | ||
onPassing={this.updateLog('onPassing')} | ||
onPassingReverse={this.updateLog('onPassingReverse')} | ||
onOnScreen={this.updateLog('onOnScreen')} | ||
onOffScreen={this.updateLog('onOffScreen')} | ||
> | ||
<Wireframe /> | ||
</Visibility> | ||
</Grid.Column> | ||
|
||
<Grid.Column> | ||
<Sticky context={contextRef}> | ||
<Segment.Group> | ||
<Segment> | ||
<Checkbox checked={once} label='Once' onChange={this.toggleOnce} toggle /> | ||
<Divider /> | ||
<Checkbox checked={continuous} label='Continuous' onChange={this.toggleContinuous} toggle /> | ||
</Segment> | ||
<Segment> | ||
<Button compact size='small' floated='right' onClick={this.clearLog}>Clear</Button> | ||
Event Log <Label circular>{logCount}</Label> | ||
</Segment> | ||
<Segment secondary> | ||
<pre>{log.map((e, i) => <div key={i}>{e}</div>)}</pre> | ||
</Segment> | ||
</Segment.Group> | ||
</Sticky> | ||
</Grid.Column> | ||
</Grid> | ||
</div> | ||
) | ||
} | ||
} |
Oops, something went wrong.