File tree Expand file tree Collapse file tree 7 files changed +196
-51
lines changed Expand file tree Collapse file tree 7 files changed +196
-51
lines changed Original file line number Diff line number Diff line change 2
2
"name" : " website" ,
3
3
"version" : " 0.0.0" ,
4
4
"dependencies" : {
5
+ "@atlaskit/code" : " ^9.0.0" ,
5
6
"@atlaskit/css-reset" : " ^3.0.6" ,
6
7
"bolt" : " ^0.22.6" ,
7
8
"css-loader" : " ^2.1.1" ,
12
13
"react-codemirror" : " ^1.0.0" ,
13
14
"react-dom" : " ^16.3.1" ,
14
15
"react-markdown" : " ^4.0.6" ,
15
- "react-router-dom" : " ^5.0.0"
16
+ "react-router-dom" : " ^5.0.0" ,
17
+ "styled-components" : " ^4.2.0"
16
18
},
17
19
"devDependencies" : {
18
20
"@babel/core" : " ^7.4.0" ,
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import ReactDOM from 'react-dom' ;
3
- import { BrowserRouter as Router , Route } from 'react-router-dom' ;
3
+ import { HashRouter as Router , Route } from 'react-router-dom' ;
4
4
import '@atlaskit/css-reset' ;
5
5
6
6
import Header from './components/Header' ;
@@ -10,9 +10,9 @@ import Repl from './pages/Repl';
10
10
11
11
const App = ( ) => (
12
12
< Router >
13
- < Header />
14
- < Route path = "/" exact component = { Home } />
15
- < Route path = "/packages" component = { PackageDoc } />
13
+ < Route path = "*" component = { Header } />
14
+ { /* <Route path="/" exact component={Home} /> */ }
15
+ < Route path = "/" exact component = { PackageDoc } />
16
16
< Route path = "/repl" component = { Repl } />
17
17
</ Router >
18
18
) ;
Original file line number Diff line number Diff line change @@ -2,22 +2,32 @@ import React from 'react';
2
2
import { Link } from 'react-router-dom' ;
3
3
import './style.css' ;
4
4
5
- export default ( ) => (
6
- < nav >
7
- < div className = "side-bar" >
8
- < h1 > Pretty proptypes</ h1 >
5
+ export default ( { location } ) => {
6
+ const ifPathNameEqualTo = pathName => {
7
+ console . log ( location ) ;
8
+ return location && location . pathname === pathName ;
9
+ } ;
10
+ return (
11
+ < nav >
12
+ < h1 > Extract React Types</ h1 >
9
13
< div className = "header-controls" >
10
- < label >
14
+ { /* <label>
11
15
Type system:
12
16
<select>
13
17
<option value="flow">Flow</option>
14
18
<option value="typescript">TypeScript</option>
15
19
</select>
16
- </ label >
17
- < Link to = "/" > Home</ Link >
18
- < Link to = "/packages" > Packages</ Link >
19
- < Link to = "/repl" > Try it out</ Link >
20
+ </label> */ }
21
+ { /* <Link to="/" className={ifPathNameEqualTo('/') ? 'active' : ''}>
22
+ Home
23
+ </Link> */ }
24
+ < Link to = "/" className = { ifPathNameEqualTo ( '/' ) ? 'active' : '' } >
25
+ Packages
26
+ </ Link >
27
+ < Link to = "/repl" className = { ifPathNameEqualTo ( '/repl' ) ? 'active' : '' } >
28
+ Try it out
29
+ </ Link >
20
30
</ div >
21
- </ div >
22
- </ nav >
23
- ) ;
31
+ </ nav >
32
+ ) ;
33
+ } ;
Original file line number Diff line number Diff line change 1
- . side-bar {
1
+ nav {
2
2
background : linear-gradient (270deg , # 6738ff, # c3ffbf );
3
- color : # 6554c0 ;
4
3
padding : 15px ;
5
4
display : flex;
6
5
align-items : center;
7
6
justify-content : space-between;
8
7
height : 50px ;
9
8
}
10
9
11
- . side-bar h1 {
10
+ nav h1 {
12
11
display : inline-block;
13
12
text-shadow : 7px 6px 20px # 6a4fc6 ;
14
13
margin : 5px ;
15
14
}
16
15
17
- .side-bar .header-controls {
18
- color : # c0feba ;
16
+ nav .header-controls a {
17
+ color : # ffffff ;
18
+ font-weight : bold;
19
+ margin-left : 15px ;
20
+ }
21
+
22
+ nav .header-controls a .active {
23
+ text-decoration : underline;
19
24
}
20
25
21
- . side-bar .header-controls select {
26
+ nav .header-controls select {
22
27
margin-left : 10px ;
23
28
}
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
- import ReactMarkdown from 'react-markdown' ;
3
+ import ReactMarkdown from 'react-markdown/with-html' ;
4
+ import { AkCodeBlock } from '@atlaskit/code' ;
4
5
import docs from '../../../DOCS' ;
5
6
import './style.css' ;
6
7
8
+ const kebabToCamelCase = string => string . replace ( / - ( [ a - z ] ) / g, s => ` ${ s [ 1 ] } ` ) ;
9
+
10
+ const CodeBlock = ( { value } ) => < AkCodeBlock text = { value } /> ;
11
+
7
12
export default function PackageDoc ( { location } ) {
8
13
let params = new URLSearchParams ( location . search ) ;
9
14
let docName = params . get ( 'package' ) ;
10
15
return (
11
- < main >
12
- < sidebar >
13
- < ul >
14
- { Object . keys ( docs ) . map ( docTitle => (
15
- < li className = { docName && docName === docTitle ? 'active' : '' } >
16
- < Link to = { { pathname : '/packages' , search : `package=${ docTitle } ` } } > { docTitle } </ Link >
17
- </ li >
18
- ) ) }
19
- </ ul >
20
- </ sidebar >
21
- < article >
22
- < ReactMarkdown source = { docs [ docName || Object . keys ( docs ) [ 0 ] ] } />
23
- </ article >
24
- </ main >
16
+ < div className = "package-documentation" >
17
+ < main >
18
+ < section >
19
+ < ul >
20
+ { Object . keys ( docs ) . map ( docTitle => (
21
+ < li key = { docTitle } className = { docName && docName === docTitle ? 'active' : '' } >
22
+ < Link to = { { pathname : '/' , search : `package=${ docTitle } ` } } >
23
+ { kebabToCamelCase ( docTitle ) }
24
+ </ Link >
25
+ </ li >
26
+ ) ) }
27
+ </ ul >
28
+ </ section >
29
+ < article >
30
+ < ReactMarkdown
31
+ source = { docs [ docName || Object . keys ( docs ) [ 0 ] ] }
32
+ renderers = { { code : CodeBlock } }
33
+ />
34
+ </ article >
35
+ </ main >
36
+ </ div >
25
37
) ;
26
38
}
Original file line number Diff line number Diff line change
1
+ .package-documentation {
2
+ display : flex;
3
+ justify-content : center;
4
+ width : 100% ;
5
+ }
1
6
main {
2
- display : flex;
7
+ display : flex;
8
+ padding : 20px 0 ;
9
+ width : 100% ;
10
+ justify-content : center;
11
+ }
12
+ article {
13
+ border-left : 1px solid # ededed ;
14
+ margin-left : 20px ;
15
+ padding : 0 20px ;
16
+ width : 800px ;
17
+ }
18
+
19
+ article h1 {
20
+ position : relative;
21
+ padding-bottom : 15px ;
3
22
}
4
- article {
5
- margin-left : 20px ;
6
- padding : 0 20px ;
7
- border-left : 1px solid # ededed ;
23
+
24
+ article h1 ::before {
25
+ position : absolute;
26
+ content : '' ;
27
+ bottom : 5% ;
28
+ left : 0px ;
29
+ width : 30% ;
30
+ height : 3px ;
31
+ background : linear-gradient (270deg , # 6738ff, # c3ffbf );
8
32
}
9
33
10
- sidebar ul {
11
- list-style : none;
12
- font-size : 1.5em ;
34
+ section ul {
35
+ list-style : none;
36
+ font-size : 1.5em ;
13
37
}
14
38
15
- sidebar ul li a {
16
- color : # 102b4f ;
39
+ section ul li a {
40
+ color : # 8d8d8d ;
17
41
}
18
42
19
- sidebar ul li .active a {
20
- font-weight : 500 ;
21
- }
43
+ section ul li .active a {
44
+ color : # 102b4f ;
45
+ }
You can’t perform that action at this time.
0 commit comments