Skip to content

Commit 4520836

Browse files
authoredMar 2, 2020
chore(www): adds a description to the overview of features (#21306)
1 parent ae30ba8 commit 4520836

File tree

2 files changed

+84
-36
lines changed

2 files changed

+84
-36
lines changed
 
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Category,Gatsby,Jamstack,Cms,Description
2-
Performance,3,3,2,
3-
Developer Experience,3,3,2,
4-
Governance,3,2,3,
5-
Accessibility,2,2,3,
6-
Documentation,3,3,3,
7-
Ecosystem,3,2,2,
2+
Performance,3,3,2,"Builds a site that is fast with small response time, completely accessible and responsive to user input."
3+
Developer Experience,3,3,2,"Delivering robust functionality that is stable, speedy, and visually intuitive to developers"
4+
Governance,3,2,3,"Provides monitor, measure, management and security to your site"
5+
Accessibility,2,2,3,Enables access to site content and functionality to literally anyone
6+
Documentation,3,3,3,Detailed technical guides with tutorials and examples.
7+
Ecosystem,3,2,2,Resources that facilitate development as they integrate with each other
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,92 @@
11
/** @jsx jsx */
22
import { jsx } from "theme-ui"
3-
import React from "react"
4-
3+
import { Component } from "react"
54
import SectionTitle from "./evaluation-table-section-title"
65
import SectionHeaderTop from "./evaluation-table-section-header-top"
76
import { renderCell } from "./evaluation-cell"
7+
import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
88

9-
const SimpleEvaluationTable = ({ title, headers, data }) => (
10-
<React.Fragment>
11-
{title && <SectionTitle text={title} />}
12-
<table>
13-
<tbody>
14-
<SectionHeaderTop columnHeaders={headers.map(h => h.display)} />
15-
{data.map((node, idx) => (
16-
<tr key={`feature-row-${idx}`}>
17-
{headers.map((header, i) => (
9+
class SimpleEvaluationTable extends Component {
10+
constructor() {
11+
super()
12+
this.state = {}
13+
}
14+
render() {
15+
const showTooltip = (row) => this.state[`feature-cell-${row}`]
16+
const { title, headers, data } = this.props
17+
return (
18+
<div>
19+
{title && <SectionTitle text={title} />}
20+
<table>
21+
<tbody>
22+
<SectionHeaderTop columnHeaders={headers.map(h => h.display)} />
23+
{data.map((node, idx) =>
24+
[].concat([
25+
<tr key={`feature-first-row-${idx}`}>
26+
{headers.map((header, i) => (
27+
<td
28+
key={`feature-cell-${idx}-${i}`}
29+
sx={{
30+
display: `table-cell`,
31+
"&:hover": {
32+
cursor: `pointer`,
33+
},
34+
borderBottom: t =>
35+
!showTooltip(idx)
36+
? `1px solid ${t.colors.ui.border}`
37+
: `none`,
38+
minWidth: 40,
39+
paddingRight: 0,
40+
paddingLeft: 0,
41+
textAlign: `left`,
42+
verticalAlign: `middle`,
43+
fontSize: 1,
44+
lineHeight: `solid`,
45+
}}
46+
onClick={() => {
47+
this.setState({
48+
[`feature-cell-${idx}`]: !showTooltip(idx),
49+
})
50+
}}
51+
>
52+
{renderCell(node[header.nodeFieldProperty], i)}
53+
</td>
54+
))}
55+
</tr>,
56+
// table row containing details of each feature
57+
<tr
58+
style={{
59+
display: showTooltip(idx) ? `table-row` : `none`,
60+
}}
61+
key={`feature-second-row-${idx}`}
62+
>
1863
<td
19-
key={`feature-cell-${idx}-${i}`}
2064
sx={{
21-
display: `table-cell`,
22-
"&:hover": {
23-
cursor: `pointer`,
65+
paddingBottom: t => `calc(${t.space[5]} - 1px)`,
66+
"&&": {
67+
[mediaQueries.xs]: {
68+
px: 3,
69+
},
2470
},
25-
borderBottom: t => `1px solid ${t.colors.ui.border}`,
26-
minWidth: 40,
27-
px: 0,
28-
textAlign: `left`,
29-
verticalAlign: `middle`,
30-
fontSize: 1,
31-
lineHeight: `solid`,
3271
}}
72+
colSpan="5"
3373
>
34-
{renderCell(node[header.nodeFieldProperty], i)}
74+
{
75+
<span
76+
dangerouslySetInnerHTML={{
77+
__html: node.Description,
78+
}}
79+
/>
80+
}
3581
</td>
36-
))}
37-
</tr>
38-
))}
39-
</tbody>
40-
</table>
41-
</React.Fragment>
42-
)
82+
</tr>,
83+
]))}
84+
</tbody>
85+
</table>
86+
</div>
87+
)
88+
}
89+
}
4390

4491
export default SimpleEvaluationTable
92+

0 commit comments

Comments
 (0)
Please sign in to comment.