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 1
1
import React from 'react'
2
2
3
- export default function DescriptiveItem ( props ) {
4
- console . log ( 'DescriptiveItem props: ' , props )
3
+ export default function DescriptiveItem ( { section } ) {
4
+ console . log ( 'DescriptiveItem props: ' , section )
5
5
return (
6
6
< div >
7
- { props . section . subsections . map ( secData => {
7
+ { section . subsections . map ( secData => {
8
8
// console.log('secData: ', secData)
9
9
return (
10
10
< div
@@ -27,14 +27,14 @@ export default function DescriptiveItem(props) {
27
27
28
28
{ secData . external_links && (
29
29
< ul >
30
- { secData . external_links . map ( ( link , i ) => (
31
- < li key = { i } >
30
+ { secData . external_links . map ( link => (
31
+ < li key = { link . _id } >
32
32
< a
33
33
href = { link . href }
34
34
target = "_blank"
35
35
rel = "noopener noreferrer"
36
36
>
37
- { link . linkDescription }
37
+ { link . description }
38
38
</ a >
39
39
</ li >
40
40
) ) }
Original file line number Diff line number Diff line change @@ -18,8 +18,17 @@ export default function ShortcutTable(props) {
18
18
return (
19
19
< tr key = { secData . name } >
20
20
< 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 >
23
32
</ tr >
24
33
)
25
34
} ) }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export default function TableOfContents({ data }) {
6
6
< div >
7
7
< h2 > Table of Contents</ h2 >
8
8
< 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 */ }
10
10
< ul >
11
11
{ data . map ( ( { node } ) => {
12
12
console . log ( 'node map' , node )
Original file line number Diff line number Diff line change @@ -5,14 +5,23 @@ import DescriptiveItem from './DescriptiveItem'
5
5
export default function TopicSection ( props ) {
6
6
console . log ( 'TopicSection props: ' , props )
7
7
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
+ >
10
19
{ props . section . name }
11
20
</ h3 >
12
21
13
- { props . section . sectionDescription && (
22
+ { props . section . description && (
14
23
< p className = "section_description" >
15
- { props . section . sectionDescription }
24
+ { props . section . description }
16
25
</ p >
17
26
) }
18
27
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { Link } from 'gatsby'
3
- import Footer from './footer'
3
+
4
4
5
5
const ListLink = props => (
6
6
< li >
@@ -9,6 +9,9 @@ const ListLink = props => (
9
9
)
10
10
11
11
export 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 )
12
15
return (
13
16
< div id = 'layout' >
14
17
< header >
@@ -18,8 +21,12 @@ export default function Layout({ children }) {
18
21
19
22
< nav >
20
23
< 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
+
23
30
</ ul >
24
31
</ nav >
25
32
</ header >
@@ -28,7 +35,7 @@ export default function Layout({ children }) {
28
35
{ children }
29
36
</ div >
30
37
31
- < Footer />
38
+
32
39
</ div >
33
40
)
34
41
}
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { graphql } from 'gatsby'
3
3
import Layout from '../../components/layout'
4
+ import Footer from '../../components/footer'
4
5
import ToC from '../../components/TableOfContents'
5
6
import TopicSection from '../../components/TopicSection'
6
7
7
8
export default function Index ( { data } ) {
8
- console . log ( 'data: ' , data )
9
+ console . log ( 'Index data: ' , data )
9
10
return (
11
+ < div >
10
12
< Layout >
11
13
< ToC data = { data . allSanitySection . edges } />
14
+
12
15
{ 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
+ )
14
22
} ) }
15
-
16
23
</ Layout >
24
+
25
+ < Footer />
26
+ </ div >
17
27
)
18
28
}
19
29
Original file line number Diff line number Diff line change
1
+ * {
2
+ margin : 0 ;
3
+ padding : 0 ;
4
+ box-sizing : border-box;
5
+ }
6
+
1
7
# layout {
2
8
margin : 2rem auto;
3
- max-width : 700 px ;
9
+ max-width : 800 px ;
4
10
padding : 0 1rem ;
5
11
}
6
12
19
25
}
20
26
21
27
.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