Skip to content

Commit 493ef64

Browse files
committed
(∩◕ヮ◕)⊃━ ✧.*・。゚ PAGE TRANSITIONS
0 parents  commit 493ef64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+7032
-0
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": [["styled-jsx/babel", { "plugins": ["styled-jsx-plugin-sass"] }]]
3+
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.next

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Page Transitions Travelapp
2+
3+
### Fork
4+
5+
👋, hello there! This repository is a rewrite with React & Next.js of [Sarah Drasner](https://twitter.com/sarah_edo)'s orginal work with [Vue & Nuxt](https://github.com/sdras/page-transitions-travelapp).
6+
7+
Live demo: [https://travel.now.sh](https://page-transitions.now.sh)
8+
9+
### Original
10+
11+
This demo shows an example of how to acheive native-like page transitions on the web. There's much to be improved here- it's not meant to be a full-fledged web application, just a quick demo to show how this kind of implementation could theoretically work. These concepts can and should be expressed differently in your own application, the sky's the limit here! This is created with Nuxt and Vue.
12+
13+
Article explaining the demo is available at
14+
[https://css-tricks.com/native-like-animations-for-page-transitions-on-the-web](https://css-tricks.com/native-like-animations-for-page-transitions-on-the-web)
15+
16+
Live demo at
17+
[https://page-transitions.com/](https://page-transitions.com/)
18+
19+
See the page transitions travel app demo for a real-life use case: [https://github.com/sdras/page-transitions-travelapp](https://github.com/sdras/page-transitions-travelapp)
20+
21+
## Build Setup
22+
23+
```bash
24+
# install dependencies
25+
$ npm install # Or yarn install
26+
27+
# serve with hot reload at localhost:3000
28+
$ npm run dev
29+
30+
# build for production and launch server
31+
$ npm run build
32+
$ npm start
33+
```
34+
35+
For detailed explanation on how things work, checkout the [Next.js docs](https://github.com/zeit/next.js).

components/AppFooter.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from 'react';
2+
3+
export default () => (
4+
<footer>
5+
<div>
6+
Original project by{' '}
7+
<a href="https://twitter.com/sarah_edo" target="_blank">
8+
sarah_edo
9+
</a>, built with{' '}
10+
<a
11+
href="https://github.com/sdras/page-transitions-travelapp"
12+
target="_blank"
13+
>
14+
Vue & Nuxt (code)
15+
</a>
16+
</div>
17+
<div>
18+
You are viewing a fork adapted by{' '}
19+
<a href="https://twitter.com/xavczen" target="_blank">
20+
xavczen
21+
</a>, built with{' '}
22+
<a
23+
href="https://github.com/xavczen/nextjs-transitions-travelapp"
24+
target="_blank"
25+
>
26+
React & Next (code)
27+
</a>.
28+
</div>
29+
<style jsx>
30+
{`
31+
footer {
32+
display: flex;
33+
flex-direction: column;
34+
justify-content: center;
35+
align-items: center;
36+
padding: 10px;
37+
background: black;
38+
color: white;
39+
text-align: center;
40+
letter-spacing: 0.03em;
41+
margin-top: 30px;
42+
width: 100%;
43+
}
44+
45+
a,
46+
a:visited,
47+
a:active {
48+
color: white;
49+
font-weight: bold;
50+
text-decoration: none;
51+
padding-left: 6px;
52+
}
53+
`}
54+
</style>
55+
</footer>
56+
);

components/AppMenuDrawer.js

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import React from 'react';
2+
import Link from 'next/link';
3+
import { CSSTransition, TransitionGroup } from 'react-transition-group';
4+
import { TweenMax, Sine } from 'gsap';
5+
6+
export default class AppMenuDrawer extends React.Component {
7+
menuRef = React.createRef();
8+
9+
componentDidMount() {
10+
const menuEl = this.menuRef.current;
11+
12+
TweenMax.set(menuEl, {
13+
opacity: 0,
14+
scale: 0,
15+
transformOrigin: '100% 0%',
16+
});
17+
18+
TweenMax.set(menuEl.childNodes, {
19+
opacity: 0,
20+
});
21+
22+
TweenMax.fromTo(
23+
menuEl,
24+
0.2,
25+
{
26+
opacity: 0,
27+
scale: 0,
28+
},
29+
{
30+
opacity: 1,
31+
scale: 1,
32+
ease: Sine.easeOut,
33+
}
34+
);
35+
36+
TweenMax.staggerFromTo(
37+
menuEl.childNodes,
38+
0.45,
39+
{
40+
opacity: 0,
41+
},
42+
{
43+
delay: 0.1,
44+
opacity: 1,
45+
ease: Sine.easeOut,
46+
},
47+
0.04
48+
);
49+
}
50+
51+
render() {
52+
const { selectedUser } = this.props;
53+
54+
return (
55+
<div className="menudrawer" ref={this.menuRef}>
56+
<Link href="/">
57+
<a>{firstName(selectedUser.name)}'s Home</a>
58+
</Link>
59+
<br />
60+
<Link href="/place">
61+
<a>{firstName(selectedUser.name)}'s Places</a>
62+
</Link>
63+
<br />
64+
<Link href="/group">
65+
<a>{firstName(selectedUser.name)}'s Group Trips</a>
66+
</Link>
67+
<style jsx>
68+
{`
69+
div {
70+
background: rgba(0, 0, 0, 0.8);
71+
line-height: 1.8;
72+
text-align: right;
73+
position: absolute;
74+
right: 0px;
75+
top: 45px;
76+
padding: 20px;
77+
border-radius: 4px;
78+
z-index: 10000;
79+
}
80+
81+
a,
82+
a:visited,
83+
a:active {
84+
cursor: pointer;
85+
color: white;
86+
}
87+
`}
88+
</style>
89+
</div>
90+
);
91+
}
92+
}
93+
94+
const firstName = input => {
95+
const lastIndex = input.lastIndexOf(' ');
96+
return input.substring(0, lastIndex);
97+
};

0 commit comments

Comments
 (0)