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 22 "name" : " website" ,
33 "version" : " 0.0.0" ,
44 "dependencies" : {
5+ "@atlaskit/code" : " ^9.0.0" ,
56 "@atlaskit/css-reset" : " ^3.0.6" ,
67 "bolt" : " ^0.22.6" ,
78 "css-loader" : " ^2.1.1" ,
1213 "react-codemirror" : " ^1.0.0" ,
1314 "react-dom" : " ^16.3.1" ,
1415 "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"
1618 },
1719 "devDependencies" : {
1820 "@babel/core" : " ^7.4.0" ,
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
3- import { BrowserRouter as Router , Route } from 'react-router-dom' ;
3+ import { HashRouter as Router , Route } from 'react-router-dom' ;
44import '@atlaskit/css-reset' ;
55
66import Header from './components/Header' ;
@@ -10,9 +10,9 @@ import Repl from './pages/Repl';
1010
1111const App = ( ) => (
1212 < 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 } />
1616 < Route path = "/repl" component = { Repl } />
1717 </ Router >
1818) ;
Original file line number Diff line number Diff line change @@ -2,22 +2,32 @@ import React from 'react';
22import { Link } from 'react-router-dom' ;
33import './style.css' ;
44
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 >
913 < div className = "header-controls" >
10- < label >
14+ { /* <label>
1115 Type system:
1216 <select>
1317 <option value="flow">Flow</option>
1418 <option value="typescript">TypeScript</option>
1519 </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 >
2030 </ 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 {
22 background : linear-gradient (270deg , # 6738ff, # c3ffbf );
3- color : # 6554c0 ;
43 padding : 15px ;
54 display : flex;
65 align-items : center;
76 justify-content : space-between;
87 height : 50px ;
98 }
109
11- . side-bar h1 {
10+ nav h1 {
1211 display : inline-block;
1312 text-shadow : 7px 6px 20px # 6a4fc6 ;
1413 margin : 5px ;
1514 }
1615
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;
1924 }
2025
21- . side-bar .header-controls select {
26+ nav .header-controls select {
2227 margin-left : 10px ;
2328 }
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { 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' ;
45import docs from '../../../DOCS' ;
56import './style.css' ;
67
8+ const kebabToCamelCase = string => string . replace ( / - ( [ a - z ] ) / g, s => ` ${ s [ 1 ] } ` ) ;
9+
10+ const CodeBlock = ( { value } ) => < AkCodeBlock text = { value } /> ;
11+
712export default function PackageDoc ( { location } ) {
813 let params = new URLSearchParams ( location . search ) ;
914 let docName = params . get ( 'package' ) ;
1015 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 >
2537 ) ;
2638}
Original file line number Diff line number Diff line change 1+ .package-documentation {
2+ display : flex;
3+ justify-content : center;
4+ width : 100% ;
5+ }
16main {
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 ;
322}
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 );
832}
933
10- sidebar ul {
11- list-style : none;
12- font-size : 1.5em ;
34+ section ul {
35+ list-style : none;
36+ font-size : 1.5em ;
1337}
1438
15- sidebar ul li a {
16- color : # 102b4f ;
39+ section ul li a {
40+ color : # 8d8d8d ;
1741}
1842
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