Skip to content

Commit 88673bd

Browse files
committed
ADD react-router
IMPROVE style
1 parent 2e5c244 commit 88673bd

File tree

6 files changed

+151
-11
lines changed

6 files changed

+151
-11
lines changed

package-lock.json

Lines changed: 72 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
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"react": "^16.3.2",
77
"react-dom": "^16.3.2",
8+
"react-router-dom": "^4.3.1",
89
"react-scripts": "1.1.4"
910
},
1011
"scripts": {
@@ -13,4 +14,4 @@
1314
"test": "react-scripts test --env=jsdom",
1415
"eject": "react-scripts eject"
1516
}
16-
}
17+
}

src/App.css

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
}
1010

1111
.App-header {
12-
background-color: #222;
12+
background-color: #222 !important;
13+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEUaGhohISElJSUh9lebAAABwElEQVR4AY3Vua3gOBgGQQXZhgKYgwHJYAA0Ksu9CAh6hxbTbvFzfx6rNEGlHY6z5KvMw4s43mN2Z5fqYLzKyrfyXhXKnKBdD9n58UWW3Vlb3mOCmWoHHZbdV5lv8t7Ver6ldsfqumVAdbblxxcZVcd7QWq2Y6VsadS4ZTzFDbFa5XivqlxVUFG1Jd6k66u8x0RIOw0cXAiNW2z58bJ5r1LTQtVVuy1x2jK+yLTlxy3v5RogszEXSB0ZF4iYWLbMMUBGPDbvpRQUVUV9kvGU6ynrIe9FOqssJcQ4oqurCjV6ytmqco4SwvGeNCoJaphwSHoK13cyuuU9ZaQI0lB1qB8zT3GL2XjKueU9pR+gH0OlqvGUzHWLQ81O0Dg95L3Uj9qxKx0pr3LdYrnlvQKlUEnV/8v4Xt6bThZROwaO5QfTUyY4GCBWu8Wf/nO4ULtj/li3mE9Z47zlx/WU94Iq7RD5XuZ6ynjIGn9yr1VhFaq2NH9s4bP4Rt5j2NFO5MBXGVsmsD5v3gslYORsd8R1i1rrIUoLKLXlvVhgKH7ApToyhk21TJhbLDvdN151vEetJtKdOtYo4SmnOvhGpjpe+xuj3X723ghdygAAAABJRU5ErkJggg==) !important;
1314
height: 150px;
1415
padding: 20px;
1516
color: white;
@@ -19,6 +20,11 @@
1920
font-size: 1.5em;
2021
}
2122

23+
.App-title-link {
24+
text-decoration: none;
25+
color: white;
26+
}
27+
2228
.App-intro {
2329
font-size: large;
2430
}
@@ -66,3 +72,40 @@
6672
.octicon:hover {
6773
fill: #4183C4;
6874
}
75+
76+
.octoicon-link:hover::after {
77+
animation: shine 1s 0s;
78+
}
79+
80+
81+
.octoicon-link {
82+
display: inline-block;
83+
position: relative;
84+
clip-path: circle(30px at 40px 40px);
85+
}
86+
87+
.octoicon-link:after {
88+
content: "";
89+
position: absolute;
90+
right: 0%;
91+
width: 25%;
92+
height: 100%;
93+
opacity: 0;
94+
transform: rotate(30deg);
95+
background: rgba(255, 255, 255, 0.13);
96+
background: linear-gradient(
97+
to right,
98+
#4183C421 0%,
99+
#4183C421 77%,
100+
#4183C480 92%,
101+
#4183C421 100%
102+
);
103+
animation: shine 1s 3s;
104+
}
105+
106+
@keyframes shine {
107+
to {
108+
opacity: 1;
109+
right: 100%;
110+
}
111+
}

src/App.jsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
import React, { Component } from 'react'
2+
import { BrowserRouter as Router, Route, Switch, Link } from 'react-router-dom'
3+
24
import logo from './logo.svg'
35
import './App.css'
46

7+
import Landing from './pages/Landing'
58
import ContextAPI from './experiments/ContextAPI'
69

710
class App extends Component {
811
render() {
912
return (
10-
<div className="App">
11-
<header className="App-header">
12-
<img src={logo} className="App-logo" alt="logo"/>
13-
<a href="https://github.com/ackvf/react-experiments"><svg height="60" className="octicon octicon-mark-github" viewBox="0 0 16 16" version="1.1"><path fillRule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg></a>
14-
<h1 className="App-title">Welcome to React Experiments</h1>
15-
</header>
16-
<ContextAPI/>
17-
</div>
13+
<Router>
14+
<div className="App">
15+
<header className="App-header">
16+
<img src={logo} className="App-logo" alt="logo"/>
17+
<a href="https://github.com/ackvf/react-experiments" className='octoicon-link'>
18+
<svg height="60" className="octicon octicon-mark-github" viewBox="0 0 16 16" version="1.1"><path fillRule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
19+
</a>
20+
<Link to='' className='App-title-link'><h1 className="App-title">Welcome to React Experiments</h1></Link>
21+
</header>
22+
<Switch>
23+
24+
<Route exact path='/context-api' component={ContextAPI}/>
25+
<Route component={Landing} />
26+
27+
</Switch>
28+
</div>
29+
</Router>
1830
)
1931
}
2032
}

src/experiments/ContextAPI/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ section c-c, .consumer {
4343
outline: 1px solid silver;
4444
}
4545

46-
section article c-c{
46+
section article c-c {
4747
outline-offset: 4px
4848
}
4949

src/pages/Landing.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react'
2+
import { Link } from 'react-router-dom'
3+
4+
export default class Landing extends React.Component {
5+
render() {
6+
return (
7+
<ul>
8+
<li><Link to='context-api'>React 16.3. Context API</Link></li>
9+
</ul>
10+
)
11+
}
12+
}

0 commit comments

Comments
 (0)