-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: height animation when there are margins, other changes
BREAKING CHANGE: now uses `react-transition-context` v5 by default, requiring React ^16.8.0. `withTransitionContext` and `simpleWithTransitionContext` have been removed. Also, `renderView` no longer receives `style`, `ref`, `key`, etc. to pass along to the `div` it returns; rendering that wrapper `div` is now managed internally.
- Loading branch information
Showing
18 changed files
with
4,990 additions
and
3,550 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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
!yarn.lock | ||
/lib | ||
/src | ||
/stories | ||
/demo | ||
/webpack.config.js | ||
/test | ||
/coverage | ||
/flow-typed | ||
|
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
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,6 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true | ||
} | ||
} |
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,112 @@ | ||
import * as React from 'react' | ||
import withStyles from '@material-ui/core/styles/withStyles' | ||
import Code from '@material-ui/icons/Code' | ||
import Collapse from '@material-ui/core/Collapse' | ||
import Button from '@material-ui/core/Button' | ||
import IconButton from '@material-ui/core/IconButton' | ||
import Typography from '@material-ui/core/Typography' | ||
import Tooltip from '@material-ui/core/Tooltip' | ||
|
||
const { useState, useCallback } = React | ||
|
||
const styles = { | ||
title: { | ||
marginTop: 40, | ||
marginBottom: 0, | ||
}, | ||
root: { | ||
margin: '20px auto', | ||
}, | ||
toolbar: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
}, | ||
toolbarSpacer: { | ||
flex: '1 1 auto', | ||
}, | ||
code: { | ||
margin: 0, | ||
padding: 20, | ||
backgroundColor: 'white', | ||
borderRadius: 4, | ||
}, | ||
example: { | ||
backgroundColor: '#eee', | ||
borderRadius: 4, | ||
display: 'flex', | ||
alignContent: 'center', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
padding: 40, | ||
}, | ||
titleAnchor: { | ||
color: '#aaa', | ||
marginLeft: 10, | ||
textDecoration: 'none', | ||
visibility: 'hidden', | ||
'$title:hover > &': { | ||
visibility: 'visible', | ||
}, | ||
}, | ||
} | ||
|
||
const Demo = ({ | ||
headerId, | ||
classes, | ||
title, | ||
code, | ||
example, | ||
hooksCode, | ||
hooksExample, | ||
}) => { | ||
const [showSource, setShowSource] = useState(false) | ||
const [api, setApi] = useState('hooks') | ||
const setRenderProps = useCallback(() => setApi('render-props'), []) | ||
const setHooks = useCallback(() => setApi('hooks'), []) | ||
return ( | ||
<div className={classes.root}> | ||
<Typography variant="h4" className={classes.title} id={headerId}> | ||
{title} | ||
{headerId && ( | ||
<a href={`#${headerId}`} className={classes.titleAnchor}> | ||
# | ||
</a> | ||
)} | ||
</Typography> | ||
<div className={classes.toolbar}> | ||
{code != null && hooksCode != null && ( | ||
<React.Fragment> | ||
<Button | ||
variant={api === 'render-props' ? 'outlined' : 'text'} | ||
onClick={setRenderProps} | ||
> | ||
Render Props | ||
</Button> | ||
<Button | ||
variant={api === 'hooks' ? 'outlined' : 'text'} | ||
onClick={setHooks} | ||
> | ||
Hooks | ||
</Button> | ||
</React.Fragment> | ||
)} | ||
<div className={classes.toolbarSpacer} /> | ||
<Tooltip title="Show Source" placement="top"> | ||
<IconButton onClick={() => setShowSource(!showSource)}> | ||
<Code /> | ||
</IconButton> | ||
</Tooltip> | ||
</div> | ||
<Collapse in={showSource}> | ||
<pre className={classes.code}> | ||
{api === 'hooks' ? hooksCode || code : code || hooksCode} | ||
</pre> | ||
</Collapse> | ||
<div className={classes.example}> | ||
{api === 'hooks' ? hooksExample || example : example || hooksExample} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default withStyles(styles)(Demo) |
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,20 @@ | ||
import * as React from 'react' | ||
import withStyles from '@material-ui/core/styles/withStyles' | ||
import SignupDemo from './examples/SignupDemo' | ||
import Typography from '@material-ui/core/Typography' | ||
|
||
const styles = { | ||
root: { | ||
margin: '0 auto', | ||
maxWidth: 600, | ||
}, | ||
} | ||
|
||
const Root = ({ classes }) => ( | ||
<div className={classes.root}> | ||
<Typography variant="h4">react-view-slider demo</Typography> | ||
<SignupDemo /> | ||
</div> | ||
) | ||
|
||
export default withStyles(styles)(Root) |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.