Skip to content

Commit 80941cc

Browse files
committed
working on some animation stuff
1 parent fcc71f4 commit 80941cc

File tree

5 files changed

+71
-9
lines changed

5 files changed

+71
-9
lines changed

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"react": "^16.7.0-alpha.2",
4040
"react-dom": "^16.7.0-alpha.2",
4141
"react-flex-columns": "^0.4.2",
42-
"react-router-dom": "^5.0.0"
42+
"react-router-dom": "^5.0.0",
43+
"react-transition-group": "^4.1.1"
4344
}
4445
}

src/projects/authentication/AuthenticationLayout.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React, { Fragment } from 'react'
22
import { Switch, Route, Redirect } from 'react-router-dom'
3+
import { TransitionGroup, CSSTransition } from 'react-transition-group'
34
import Panel from '../../ui/Panel'
45
import PageHeader from '../../ui/PageHeader'
56
import { PageHeaderTabs, Tab } from '../../ui/PageHeaderTabs'
67
import Users from './Users'
78
import SigninMethods from './SigninMethods'
89
import Templates from './Templates'
910

10-
const AuthenticationLayout = ({ match }) => {
11+
const AuthenticationLayout = ({ match, location }) => {
1112
return (
1213
<Fragment>
1314
<PageHeader title="Authentication" useMaxWidth={false}>
@@ -18,12 +19,16 @@ const AuthenticationLayout = ({ match }) => {
1819
</PageHeaderTabs>
1920
</PageHeader>
2021
<Panel>
21-
<Switch>
22-
<Route path={`${match.path}/users`} component={Users} />
23-
<Route path={`${match.path}/signin-method`} component={SigninMethods} />
24-
<Route path={`${match.path}/templates`} component={Templates} />
25-
<Redirect to={`${match.url}/users`} />
26-
</Switch>
22+
<TransitionGroup>
23+
<CSSTransition key={location.key} timeout={3000} classNames="page-transition">
24+
<Switch location={location}>
25+
<Route path={`${match.path}/users`} component={Users} />
26+
<Route path={`${match.path}/signin-method`} component={SigninMethods} />
27+
<Route path={`${match.path}/templates`} component={Templates} />
28+
<Redirect to={`${match.url}/users`} />
29+
</Switch>
30+
</CSSTransition>
31+
</TransitionGroup>
2732
</Panel>
2833
</Fragment>
2934
)

src/projects/authentication/Users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import Card from '../../ui/Card'
33

44
const Users = () => {
5-
return <Card style={{ height: '20em' }}>Useres</Card>
5+
return <Card style={{ height: '20em' }}>Users</Card>
66
}
77

88
export default Users

src/styles/ui/card.scss

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,30 @@
55
padding: 1em;
66
min-height: 3em;
77
}
8+
9+
// .card {
10+
// position: absolute;
11+
// background-color: red;
12+
// }
13+
14+
// .page-transition {
15+
// &-enter {
16+
// opacity: 0;
17+
// transform: translateX(-10em);
18+
// transition: all 1s;
19+
// }
20+
// &-enter-active {
21+
// opacity: 1;
22+
// transform: translateX(0);
23+
// }
24+
25+
// &-exit {
26+
// opacity: 1;
27+
// transform: translateX(10em);
28+
// transition: all 1s;
29+
// }
30+
// &-exit-active {
31+
// opacity: 0;
32+
// transform: translateX(0);
33+
// }
34+
// }

0 commit comments

Comments
 (0)