├── src ├── components │ ├── Card.js │ ├── Header.js │ ├── Home.js │ ├── ScrollToTopOnMount.js │ ├── HouseList.js │ ├── HouseImage.js │ ├── NotFound.js │ ├── Map.js │ ├── Grid.js │ ├── RequestViewingForm.js │ ├── HouseCard.js │ ├── HouseSummary.js │ ├── HouseCardWithAnimation.js │ ├── AnimateTransitionToHouse.js │ └── House.js ├── index.css ├── index.js ├── App.js └── data │ └── houses.js ├── public ├── favicon.ico ├── images │ ├── house1.jpg │ ├── house2.jpg │ ├── house3.jpg │ ├── house4.jpg │ ├── house5.jpg │ └── house6.jpg ├── manifest.json └── index.html ├── README.md ├── .gitignore └── package.json /src/components/Card.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | font-family: sans-serif; 5 | } -------------------------------------------------------------------------------- /public/images/house1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house1.jpg -------------------------------------------------------------------------------- /public/images/house2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house2.jpg -------------------------------------------------------------------------------- /public/images/house3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house3.jpg -------------------------------------------------------------------------------- /public/images/house4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house4.jpg -------------------------------------------------------------------------------- /public/images/house5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house5.jpg -------------------------------------------------------------------------------- /public/images/house6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sjparsons/housetopia/HEAD/public/images/house6.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Housetopia 2 | 3 | This is a project demonstrating using React Router v4 and implementing some different animations. 4 | 5 | * [Live app](http://housetopia.sjparsons.com) 6 | * [Slides](http://router-4-animation.sjparsons.com) 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import {BrowserRouter as Router} from 'react-router-dom'; 6 | 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | document.getElementById('root') 12 | ); 13 | 14 | -------------------------------------------------------------------------------- /src/components/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {Link} from 'react-router-dom' 3 | 4 | const style = { 5 | cursor: 'pointer' 6 | } 7 | 8 | const Header = ({history}) => ( 9 |
10 |

Housetopia

11 |
12 | ); 13 | 14 | export default Header; 15 | -------------------------------------------------------------------------------- /src/components/Home.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import HouseList from './HouseList' 3 | import { houses } from '../data/houses' 4 | 5 | const Home = () => ( 6 |
7 |

Welcome, you might be interested in the following houses.

8 | 9 |
10 | ); 11 | 12 | export default Home; -------------------------------------------------------------------------------- /src/components/ScrollToTopOnMount.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | /** 4 | * Straight from the React Router v4 docs 5 | */ 6 | export default class ScrollToTopOnMount extends React.Component { 7 | componentDidMount(prevProps) { 8 | window.scrollTo(0, 0) 9 | } 10 | 11 | render() { 12 | return null 13 | } 14 | } -------------------------------------------------------------------------------- /src/components/HouseList.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import HouseCardWithAnimation from './HouseCardWithAnimation'; 3 | import { Grid } from './Grid'; 4 | 5 | const HouseList = ({houses}) => ( 6 | 7 | { houses.map( house => 8 | 9 | )} 10 | 11 | ); 12 | 13 | export default HouseList; -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /src/components/HouseImage.js: -------------------------------------------------------------------------------- 1 | import styled from 'styled-components'; 2 | 3 | const HouseImage = styled.div` 4 | background-image: url(${ props => props.image }); 5 | background-size: cover; 6 | background-position: center center; 7 | width: 100%; 8 | height: ${props => props.height}; 9 | transition: height 200ms; 10 | position: relative; 11 | `; 12 | 13 | export default HouseImage; -------------------------------------------------------------------------------- /src/components/NotFound.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | 4 | const CenterContent = styled.div` 5 | display: flex; 6 | justify-content: center; 7 | align-items: center; 8 | font-size: 2em; 9 | `; 10 | 11 | const NotFound = ({location}) => { 12 | return ( 13 | 404 Aw, shucks! {location.pathname} cannot be found 14 | ); 15 | }; 16 | 17 | export default NotFound; -------------------------------------------------------------------------------- /src/components/Map.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const getMapUrl = ({mode, apiKey, params}) => 4 | `https://www.google.com/maps/embed/v1/${mode}?key=${apiKey}&${params}`; 5 | 6 | const Map = ({width, height, ...mapProps}) => ( 7 |