-
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.
- Loading branch information
Alexander Fedyashov
committed
Jun 7, 2017
1 parent
6bf47ab
commit 19a988f
Showing
27 changed files
with
1,491 additions
and
2 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
72 changes: 72 additions & 0 deletions
72
docs/app/Examples/modules/Transition/Explorers/TransitionExampleSingleExplorer.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,72 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Form, Grid, Image, Transition } from 'semantic-ui-react' | ||
|
||
const transitions = [ | ||
'scale', | ||
'fade', 'fade up', 'fade down', 'fade left', 'fade right', | ||
'horizontal flip', 'vertical flip', | ||
'drop', | ||
'fly left', 'fly right', 'fly up', 'fly down', | ||
'swing left', 'swing right', 'swing up', 'swing down', | ||
'browse', 'browse right', | ||
'slide down', 'slide up', 'slide right', | ||
] | ||
const options = transitions.map(transition => ({ key: transition, text: transition, value: transition })) | ||
|
||
export default class TransitionExampleSingleExplorer extends Component { | ||
state = { | ||
duration: 500, | ||
animation: 'scale', | ||
visible: true, | ||
} | ||
|
||
handleDuration = (e, { value: duration }) => this.setState({ duration }) | ||
|
||
handleTransition = (e, { value: animation }) => this.setState({ animation }) | ||
|
||
handleVisibility = () => { | ||
const { visible } = this.state | ||
this.setState({ visible: !visible }) | ||
} | ||
|
||
render() { | ||
const { animation, duration, visible } = this.state | ||
|
||
return ( | ||
<Grid columns={2}> | ||
<Grid.Column as={Form}> | ||
<Form.Select | ||
label='Choose transition' | ||
onChange={this.handleTransition} | ||
options={options} | ||
value={animation} | ||
/> | ||
<Form.Input | ||
label={`Duration: ${duration}ms `} | ||
min={500} | ||
max={5000} | ||
onChange={this.handleDuration} | ||
step={500} | ||
type='range' | ||
value={duration} | ||
/> | ||
<Form.Button | ||
content={visible ? 'Hide' : 'Show'} | ||
onClick={this.handleVisibility} | ||
type='button' | ||
/> | ||
</Grid.Column> | ||
|
||
<Grid.Column> | ||
<Transition | ||
animation={animation} | ||
duration={duration} | ||
into={visible} | ||
> | ||
<Image size='medium' src='/assets/images/leaves/4.png' /> | ||
</Transition> | ||
</Grid.Column> | ||
</Grid> | ||
) | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
docs/app/Examples/modules/Transition/Explorers/TransitionExampleStaticExplorer.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,65 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Form, Grid, Image, Transition } from 'semantic-ui-react' | ||
|
||
const transitions = [ | ||
'jiggle', 'flash', 'shake', 'pulse', 'tada', 'bounce', | ||
] | ||
const options = transitions.map(transition => ({ key: transition, text: transition, value: transition })) | ||
|
||
export default class TransitionExampleStaticExplorer extends Component { | ||
state = { | ||
duration: 500, | ||
animation: 'jiggle', | ||
visible: true, | ||
} | ||
|
||
handleDuration = (e, { value: duration }) => this.setState({ duration }) | ||
|
||
handleTransition = (e, { value: animation }) => this.setState({ animation }) | ||
|
||
handleVisibility = () => { | ||
const { visible } = this.state | ||
this.setState({ visible: !visible }) | ||
} | ||
|
||
render() { | ||
const { animation, duration, visible } = this.state | ||
|
||
return ( | ||
<Grid columns={2}> | ||
<Grid.Column as={Form}> | ||
<Form.Select | ||
label='Choose transition' | ||
onChange={this.handleTransition} | ||
options={options} | ||
value={animation} | ||
/> | ||
<Form.Input | ||
label={`Duration: ${duration}ms `} | ||
min={500} | ||
max={5000} | ||
onChange={this.handleDuration} | ||
step={500} | ||
type='range' | ||
value={duration} | ||
/> | ||
<Form.Button | ||
content='Run' | ||
onClick={this.handleVisibility} | ||
type='button' | ||
/> | ||
</Grid.Column> | ||
|
||
<Grid.Column> | ||
<Transition | ||
animation={animation} | ||
duration={duration} | ||
into={visible} | ||
> | ||
<Image size='medium' src='/assets/images/leaves/5.png' /> | ||
</Transition> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const TransitionTypesExamples = () => ( | ||
<ExampleSection title='Explorers'> | ||
<ComponentExample | ||
title='Single item' | ||
description='You can apply different animations and duration with a transition explorer.' | ||
examplePath='modules/Transition/Explorers/TransitionExampleSingleExplorer' | ||
/> | ||
<ComponentExample | ||
title='Static animations' | ||
description={[ | ||
'You can apply different static animations and duration with a transition explorer.', | ||
'There are no special API for static animations at now.', | ||
].join(' ')} | ||
examplePath='modules/Transition/Explorers/TransitionExampleStaticExplorer' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default TransitionTypesExamples |
49 changes: 49 additions & 0 deletions
49
docs/app/Examples/modules/Transition/Types/TransitionExampleGroup.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 { Button, Image, List, Transition } from 'semantic-ui-react' | ||
|
||
const users = [ | ||
'ade', 'chris', 'christian', 'daniel', 'elliot', 'helen', 'jenny', 'joe', 'justen', 'laura', 'matt', 'nan', 'nom', | ||
'steve', 'stevie', 'tom', 'veronika', 'zoe', | ||
] | ||
|
||
export default class TransitionExampleGroup extends Component { | ||
state = { items: users.slice(0, 5) } | ||
|
||
handleAdd = () => { | ||
const { items } = this.state | ||
this.setState({ items: users.slice(0, items.length + 1) }) | ||
} | ||
|
||
handleRemove = () => { | ||
const { items } = this.state | ||
this.setState({ items: items.slice(0, -1) }) | ||
} | ||
|
||
render() { | ||
const { items } = this.state | ||
|
||
return ( | ||
<div> | ||
<Transition.Group | ||
as={List} | ||
duration={1000} | ||
divided size='huge' | ||
verticalAlign='middle' | ||
> | ||
{items.map(item => ( | ||
<List.Item key={item}> | ||
<Image avatar src={`/assets/images/avatar/small/${item}.jpg`} /> | ||
<List.Content header={_.startCase(item)} /> | ||
</List.Item> | ||
))} | ||
</Transition.Group> | ||
|
||
<Button.Group> | ||
<Button icon='minus' onClick={this.handleRemove} /> | ||
<Button icon='plus' onClick={this.handleAdd} /> | ||
</Button.Group> | ||
</div> | ||
) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
docs/app/Examples/modules/Transition/Types/TransitionExampleTransition.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,33 @@ | ||
import React, { Component } from 'react' | ||
import { Button, Divider, Image, Transition } from 'semantic-ui-react' | ||
|
||
export default class TransitionExampleTransition extends Component { | ||
state = { visible: true } | ||
|
||
handleVisibility = () => { | ||
const { visible } = this.state | ||
this.setState({ visible: !visible }) | ||
} | ||
|
||
render() { | ||
const { visible } = this.state | ||
|
||
return ( | ||
<div> | ||
<Transition | ||
animation='scale' | ||
duration={1500} | ||
into={visible} | ||
> | ||
<Image size='small' src='/assets/images/leaves/1.png' /> | ||
</Transition> | ||
<Divider hidden /> | ||
<Button | ||
content={visible ? 'Hide' : 'Show'} | ||
onClick={this.handleVisibility} | ||
type='button' | ||
/> | ||
</div> | ||
) | ||
} | ||
} |
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,21 @@ | ||
import React from 'react' | ||
|
||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
const TransitionTypesExamples = () => ( | ||
<ExampleSection title='Types'> | ||
<ComponentExample | ||
title='Transition' | ||
description='A transition can be applied to single item.' | ||
examplePath='modules/Transition/Types/TransitionExampleTransition' | ||
/> | ||
<ComponentExample | ||
title='Transition Group' | ||
description='A transition can be applied to items group.' | ||
examplePath='modules/Transition/Types/TransitionExampleGroup' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default TransitionTypesExamples |
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,13 @@ | ||
import React from 'react' | ||
|
||
import Explorers from './Explorers' | ||
import Types from './Types' | ||
|
||
const TransitionExamples = () => ( | ||
<div> | ||
<Types /> | ||
<Explorers /> | ||
</div> | ||
) | ||
|
||
export default TransitionExamples |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.