File tree Expand file tree Collapse file tree 7 files changed +145
-23
lines changed Expand file tree Collapse file tree 7 files changed +145
-23
lines changed Original file line number Diff line number Diff line change 11import React from 'react'
22
3- export default function DescriptiveItem ( props ) {
4- console . log ( 'DescriptiveItem props: ' , props )
3+ export default function DescriptiveItem ( { section } ) {
4+ console . log ( 'DescriptiveItem props: ' , section )
55 return (
66 < div >
7- { props . section . subsections . map ( secData => {
7+ { section . subsections . map ( secData => {
88 // console.log('secData: ', secData)
99 return (
1010 < div
@@ -27,14 +27,14 @@ export default function DescriptiveItem(props) {
2727
2828 { secData . external_links && (
2929 < ul >
30- { secData . external_links . map ( ( link , i ) => (
31- < li key = { i } >
30+ { secData . external_links . map ( link => (
31+ < li key = { link . _id } >
3232 < a
3333 href = { link . href }
3434 target = "_blank"
3535 rel = "noopener noreferrer"
3636 >
37- { link . linkDescription }
37+ { link . description }
3838 </ a >
3939 </ li >
4040 ) ) }
Original file line number Diff line number Diff line change @@ -18,8 +18,17 @@ export default function ShortcutTable(props) {
1818 return (
1919 < tr key = { secData . name } >
2020 < th className = "row_header" > { secData . name } </ th >
21- < td > < kbd > { secData . mac_command } </ kbd > </ td >
22- < td > < kbd > { secData . windows_command } </ kbd > </ td >
21+ < td >
22+ { secData . mac_command &&
23+ < kbd > { secData . mac_command } </ kbd >
24+ }
25+
26+ </ td >
27+ < td >
28+ { secData . windows_command &&
29+ < kbd > { secData . windows_command } </ kbd >
30+ }
31+ </ td >
2332 </ tr >
2433 )
2534 } ) }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default function TableOfContents({ data }) {
66 < div >
77 < h2 > Table of Contents</ h2 >
88 < nav >
9- { /* TODO: figure out some way to order the different sections */ }
9+ { /* TODO: figure out some way to order the different sections and subsections */ }
1010 < ul >
1111 { data . map ( ( { node } ) => {
1212 console . log ( 'node map' , node )
Original file line number Diff line number Diff line change @@ -5,14 +5,23 @@ import DescriptiveItem from './DescriptiveItem'
55export default function TopicSection ( props ) {
66 console . log ( 'TopicSection props: ' , props )
77 return (
8- < section id = { props . section . anchor_id } >
9- < h3 className = { props . section_active ? 'incomplete_section' : '' } >
8+ < section
9+ id = { props . section . anchor_id }
10+ // key={props.section._id}
11+ >
12+ < h3
13+ className = {
14+ props . section . section_active
15+ ? ''
16+ : 'incomplete_section'
17+ }
18+ >
1019 { props . section . name }
1120 </ h3 >
1221
13- { props . section . sectionDescription && (
22+ { props . section . description && (
1423 < p className = "section_description" >
15- { props . section . sectionDescription }
24+ { props . section . description }
1625 </ p >
1726 ) }
1827
Original file line number Diff line number Diff line change 11import React from 'react'
22import { Link } from 'gatsby'
3- import Footer from './footer'
3+
44
55const ListLink = props => (
66 < li >
@@ -9,6 +9,9 @@ const ListLink = props => (
99)
1010
1111export default function Layout ( { children } ) {
12+ // TODO: is it problematic getting pathname from window? Better way to do it using Gatsby with Reach Router?
13+ const path = window . location . pathname
14+ console . log ( 'path: ' , path )
1215 return (
1316 < div id = 'layout' >
1417 < header >
@@ -18,8 +21,12 @@ export default function Layout({ children }) {
1821
1922 < nav >
2023 < ul >
21- < ListLink to = '/' > Home</ ListLink >
22- < ListLink to = '/about' > About</ ListLink >
24+ { path === "/"
25+ ? < ListLink to = '/about' > About</ ListLink >
26+ : < ListLink to = '/' > Home</ ListLink >
27+ }
28+
29+
2330 </ ul >
2431 </ nav >
2532 </ header >
@@ -28,7 +35,7 @@ export default function Layout({ children }) {
2835 { children }
2936 </ div >
3037
31- < Footer />
38+
3239 </ div >
3340 )
3441}
Original file line number Diff line number Diff line change 11import React from 'react'
22import { graphql } from 'gatsby'
33import Layout from '../../components/layout'
4+ import Footer from '../../components/footer'
45import ToC from '../../components/TableOfContents'
56import TopicSection from '../../components/TopicSection'
67
78export default function Index ( { data } ) {
8- console . log ( 'data: ' , data )
9+ console . log ( 'Index data: ' , data )
910 return (
11+ < div >
1012 < Layout >
1113 < ToC data = { data . allSanitySection . edges } />
14+
1215 { data . allSanitySection . edges . map ( section => {
13- return < TopicSection section = { section . node } />
16+ return (
17+ < TopicSection
18+ section = { section . node }
19+ key = { section . _id }
20+ />
21+ )
1422 } ) }
15-
1623 </ Layout >
24+
25+ < Footer />
26+ </ div >
1727 )
1828}
1929
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ box-sizing : border-box;
5+ }
6+
17# layout {
28 margin : 2rem auto;
3- max-width : 700 px ;
9+ max-width : 800 px ;
410 padding : 0 1rem ;
511}
612
1925}
2026
2127.incomplete_section ::after {
22- content : ' (Coming Soon)'
23- }
28+ content : ' (Coming Soon)' ;
29+ }
30+
31+ .table_container {
32+ overflow-x : auto;
33+ }
34+
35+ table {
36+ width : 100% ;
37+ }
38+
39+ table , th , td {
40+ font-size : .9em ;
41+ border : 1px solid rgb (144 , 210 , 245 );
42+ border-collapse : collapse;
43+ text-align : center;
44+ margin : 10px 0 ;
45+ /* overriding gatsby typography? */
46+ line-height : 1.2 ;
47+ }
48+
49+ thead th {
50+ background-color : rgb (144 , 210 , 245 );
51+ }
52+
53+ thead th : first-of-type ,
54+ thead th : first-of-type + th ,
55+ .row_header ,
56+ .row_header + td {
57+ border-right : 1px solid rgb (94 , 183 , 232 );
58+ }
59+
60+ th {
61+ padding : 10px ;
62+ }
63+
64+ td {
65+ height : 35px ;
66+ padding : 5px 10px ;
67+ }
68+
69+ /* overriding gatsby typography? */
70+ td : last-child {
71+ padding-right : 10px ;
72+ }
73+
74+ tr : nth-of-type (even ) {
75+ background-color : rgb (235 , 232 , 232 );
76+ }
77+
78+ tr : nth-of-type (odd ) {
79+ background-color : white;
80+ }
81+
82+ /* .row_header {
83+ font-family: 'Barlow', sans-serif;
84+ } */
85+
86+ tr th : first-child , tr td : first-child {
87+ width : 20% ;
88+ padding : 3px ;
89+ }
90+
91+ kbd {
92+ font-family : 'Courier Prime' , monospace;
93+ background-color : rgb (34 , 34 , 34 );
94+ color : white;
95+ padding : 5px ;
96+ border-radius : 3px ;
97+ white-space : nowrap;
98+ /* overriding gatsby typography? */
99+ font-size : .9em ;
100+ }
101+
102+ footer {
103+ margin : 40px 0 0 ;
104+ text-align : center;
105+ border-top : 1px solid rgb (94 , 183 , 232 );
106+ }
107+
108+ footer span {
109+ display : block;
110+ }
You can’t perform that action at this time.
0 commit comments