forked from WebDevN-F/thenativeweb-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
226 changed files
with
7,680 additions
and
3,691 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
styleguide/out | ||
styleguide/.next | ||
|
||
test/shared/sampleApplication/out | ||
test/shared/sampleApplication/.next |
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,3 +1,4 @@ | ||
.dependabot | ||
.github | ||
test/ | ||
styleguide/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { ComponentPreview } from '../../../components/documentation/ComponentPreview'; | ||
import { DropdownOption } from '../../input/Dropdown'; | ||
import { TransitionType } from './TransitionType'; | ||
import { types } from './types'; | ||
import { CheckBox, ControlGroup, ControlGroupItem, Dropdown, Form, Headline, Paragraph, Transition } from '../../..'; | ||
import React, { ReactElement, useState } from 'react'; | ||
|
||
const transitionTypes = Object.keys(types).map((type): DropdownOption => ({ label: type, value: type })); | ||
|
||
const Documentation = (): ReactElement => { | ||
const [ isBoxVisible, setIsBoxVisible ] = useState(true); | ||
const [ type, setType ] = useState(transitionTypes[0].value); | ||
|
||
return ( | ||
<React.Fragment> | ||
<Headline>Transition</Headline> | ||
|
||
<Paragraph> | ||
Transition is a component for animating a single element while it enters | ||
or leaves your application. There's a set of built-in types you can | ||
use: <code>Fade</code>, <code>FadeInLeft</code>, <code>FadeInRight</code>, <code>Grow</code> and <code>Zoom</code>. | ||
Wrap the component that should be animated and use the | ||
boolean <code>in</code> property to animate in and out. Please note that | ||
you might have to set explicit dimensions to the parent of the animated | ||
component in order to prevent a page jumps. | ||
</Paragraph> | ||
|
||
<ComponentPreview> | ||
<React.Fragment> | ||
<Form> | ||
<ControlGroup> | ||
<ControlGroupItem label='Transition type'> | ||
<Dropdown | ||
value={ type } | ||
|
||
options={ transitionTypes } | ||
onChange={ (value: string): void => setType(value) } | ||
/> | ||
</ControlGroupItem> | ||
</ControlGroup> | ||
<ControlGroup> | ||
<ControlGroupItem label='Show box'> | ||
<CheckBox onChange={ (): void => setIsBoxVisible(!isBoxVisible) } id='checkbox-is-box-visible' /> | ||
</ControlGroupItem> | ||
</ControlGroup> | ||
</Form> | ||
|
||
<div style={{ width: 200, height: 200 }}> | ||
<Transition type={ type as TransitionType } in={ isBoxVisible }> | ||
<div | ||
style={{ | ||
width: 200, | ||
height: 200, | ||
background: 'deeppink' | ||
}} | ||
> | ||
This box will be animated using {type}. | ||
</div> | ||
</Transition> | ||
</div> | ||
</React.Fragment> | ||
</ComponentPreview> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export { Documentation }; |
This file was deleted.
Oops, something went wrong.
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
60 changes: 60 additions & 0 deletions
60
lib/components/animation/TransitionGroup/Documentation.tsx
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,60 @@ | ||
import { ComponentPreview } from '../../../components/documentation/ComponentPreview'; | ||
import { Button, Headline, Paragraph, TransitionGroup } from '../../..'; | ||
import React, { ReactElement, useState } from 'react'; | ||
|
||
const Documentation = (): ReactElement => { | ||
const [ items, setItems ] = useState([ 'Thing 1' ]); | ||
|
||
const addItem = (): void => { | ||
const newItems = [ ...items, `Thing ${items.length + 1}` ]; | ||
|
||
setItems(newItems); | ||
}; | ||
|
||
const removeItem = (): void => { | ||
const newItems = items.slice(0, -1); | ||
|
||
setItems(newItems); | ||
}; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Headline>TransitionGroup</Headline> | ||
|
||
<Paragraph> | ||
To transition an array of elements, use | ||
the <code>TransitionGroup</code> component. Please note that you have to | ||
set a unique key for each item in order to let React know which element | ||
has been added or removed. | ||
</Paragraph> | ||
|
||
<ComponentPreview> | ||
<React.Fragment> | ||
<div style={{ display: 'flex' }}> | ||
<Button onClick={ addItem }>Add item</Button> | ||
<Button onClick={ removeItem }>Remove item</Button> | ||
</div> | ||
<TransitionGroup type='FadeInRight'> | ||
{ items.map((item): ReactElement => ( | ||
<div | ||
style={{ | ||
width: 100, | ||
height: 100, | ||
float: 'left', | ||
background: 'deeppink', | ||
marginRight: 20, | ||
marginTop: 20 | ||
}} | ||
key={ item } | ||
> | ||
{item} | ||
</div> | ||
)) } | ||
</TransitionGroup> | ||
</React.Fragment> | ||
</ComponentPreview> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export { Documentation }; |
Oops, something went wrong.