-
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.
feat(Responsive): add
fireOnMount
prop (#2137)
- Loading branch information
1 parent
64bf4a1
commit 2475030
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
docs/app/Examples/addons/Responsive/Usage/ResponsiveExampleFireOnMount.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,29 @@ | ||
import React, { Component } from 'react' | ||
import { Grid, Responsive, Segment } from 'semantic-ui-react' | ||
|
||
export default class ResponsiveExampleFireOnMount extends Component { | ||
state = {} | ||
|
||
handleOnUpdate = (e, { width }) => this.setState({ width }) | ||
|
||
render() { | ||
const { width } = this.state | ||
const textAlign = width >= Responsive.onlyComputer.minWidth ? 'right' : 'left' | ||
|
||
return ( | ||
<Responsive | ||
as={Grid} | ||
columns={1} | ||
fireOnMount | ||
onUpdate={this.handleOnUpdate} | ||
> | ||
<Grid.Column textAlign={textAlign}> | ||
<Segment> | ||
This grid has responsive align of the text. It will be right aligned on computer and left aligned on other | ||
breakpoins. | ||
</Segment> | ||
</Grid.Column> | ||
</Responsive> | ||
) | ||
} | ||
} |
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
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