Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 776789d

Browse files
george treviranusgeorge
authored andcommitted
upgrade deps and webpack build
1 parent 2c14d7b commit 776789d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4797
-3504
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,5 +207,6 @@ module.exports = {
207207

208208
// jsx-a11y
209209
"jsx-a11y/no-noninteractive-element-interactions": OFF,
210+
"jsx-a11y/no-interactive-element-to-noninteractive-role": OFF,
210211
},
211212
}

app/components/Article/Article.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
import React, { useState, useEffect } from "react"
1+
import React, { useState } from "react"
22
import Markdown from "react-markdown"
33
import Prism from "prismjs"
44
import classNames from "classnames"
55
import PropTypes from "prop-types"
6+
import Undernet from "undernet"
67

7-
import { COMPONENTS } from "./constants"
88
import ScrollUpOnMount from "app/components/ScrollUpOnMount"
9+
import { useDidMount, useWillUnmount } from "app/helpers"
10+
11+
const SCOPE = "#article"
912

1013
export default function Article(props) {
1114
const [domIsLoaded, setDomIsLoaded] = useState(false)
1215

13-
const componentUnmountFunction = () => {
14-
COMPONENTS.forEach(Component => Component.stop())
15-
}
16+
useWillUnmount(() => Undernet.stop(SCOPE))
1617

17-
const observedState = []
18-
useEffect(() => {
18+
useDidMount(() => {
1919
Prism.highlightAll()
20-
COMPONENTS.forEach(Component => Component.start())
20+
Undernet.start(SCOPE)
2121
setDomIsLoaded(true)
22-
23-
return componentUnmountFunction
24-
}, observedState)
22+
})
2523

2624
return (
27-
<article className={classNames("article-wrapper has-no-p column", { fadeIn: domIsLoaded })}>
25+
<article
26+
id="article"
27+
className={classNames("article-wrapper has-no-p column", { fadeIn: domIsLoaded })}
28+
>
2829
<ScrollUpOnMount />
2930
<Markdown source={props.children} escapeHtml={false} />
3031
</article>

app/components/Article/__tests__/Article.spec.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import React from "react"
2-
import Article from "../Article"
32
import Prism from "prismjs"
4-
import { COMPONENTS } from "../constants"
3+
import Undernet from "undernet"
4+
import Article from "../Article"
55

66
jest.mock("app/components/ScrollUpOnMount", () => global.simpleMock("ScrollUpOnMount"))
77

88
global.scrollTo = jest.fn()
99

10-
COMPONENTS.forEach(Component => {
11-
Component.start = jest.fn()
12-
Component.stop = jest.fn()
13-
})
10+
Undernet.start = jest.fn()
11+
Undernet.stop = jest.fn()
1412

1513
jest.mock("prismjs", () => ({
1614
highlightAll: jest.fn(),
@@ -47,29 +45,25 @@ describe("<Article />", () => {
4745
// Given
4846
mountComponent()
4947
// Then
50-
expect(Prism.highlightAll).toHaveBeenCalled()
48+
expect(Prism.highlightAll).toBeCalled()
5149
})
5250

53-
COMPONENTS.forEach(Component => {
54-
it(`calls ${Component.constructor.name}.start`, () => {
55-
// Given
56-
mountComponent()
57-
// Then
58-
expect(Component.start).toHaveBeenCalled()
59-
})
51+
it("calls Undernet.start", () => {
52+
// Given
53+
mountComponent()
54+
// Then
55+
expect(Undernet.start).toBeCalled()
6056
})
6157
})
6258

6359
describe("#componentWillUnmount", () => {
64-
COMPONENTS.forEach(Component => {
65-
it(`calls ${Component.constructor.name}.stop`, () => {
66-
// Given
67-
const wrapper = mountComponent()
68-
// When
69-
wrapper.unmount()
70-
// Then
71-
expect(Component.stop).toHaveBeenCalled()
72-
})
60+
it("calls Undernet.stop", () => {
61+
// Given
62+
const wrapper = mountComponent()
63+
// When
64+
wrapper.unmount()
65+
// Then
66+
expect(Undernet.stop).toBeCalled()
7367
})
7468
})
7569
})

app/components/Article/__tests__/__snapshots__/Article.spec.js.snap

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ exports[`<Article /> #render renders 1`] = `
44
<Article>
55
<article
66
className="article-wrapper has-no-p column fadeIn"
7+
id="article"
78
>
89
<ScrollUpOnMount />
910
<ReactMarkdown
@@ -20,28 +21,28 @@ exports[`<Article /> #render renders 1`] = `
2021
transformLinkUri={[Function]}
2122
>
2223
<Root
23-
key="root-1-1"
24+
key="root-1-1-0"
2425
>
2526
<Heading
26-
key="heading-1-1"
27+
key="heading-1-1-0"
2728
level={1}
2829
>
2930
<h1>
3031
<TextRenderer
31-
key="text-1-3"
32-
nodeKey="text-1-3"
32+
key="text-1-3-0"
33+
nodeKey="text-1-3-0"
3334
value="Test header"
3435
>
3536
Test header
3637
</TextRenderer>
3738
</h1>
3839
</Heading>
3940
<p
40-
key="paragraph-2-1"
41+
key="paragraph-2-1-1"
4142
>
4243
<TextRenderer
43-
key="text-2-1"
44-
nodeKey="text-2-1"
44+
key="text-2-1-0"
45+
nodeKey="text-2-1-0"
4546
value=" So neat"
4647
>
4748
So neat

app/components/Article/constants.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/components/DocsRoutes/articles/Accordions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import AccordionsMd from "app/docs/accordions.md"
66

77
const Accordions = () => {
88
return (
9-
<React.Fragment>
9+
<>
1010
<SetMeta
1111
title="Accordions"
12-
description="A component for hiding and showing content in an accordion-style user interface."
12+
description="A component that composes a series of collapsible containers."
1313
/>
1414
<PageHeader>Accordions</PageHeader>
1515
<Article>{AccordionsMd}</Article>
16-
</React.Fragment>
16+
</>
1717
)
1818
}
1919

app/components/DocsRoutes/articles/Alignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import AlignmentMd from "app/docs/alignment.md"
66

77
const Alignment = () => {
88
return (
9-
<React.Fragment>
9+
<>
1010
<SetMeta
1111
title="Alignment"
1212
description="Utilities for creating custom alignment in web layouts."
1313
/>
1414
<PageHeader>Alignment</PageHeader>
1515
<Article>{AlignmentMd}</Article>
16-
</React.Fragment>
16+
</>
1717
)
1818
}
1919

app/components/DocsRoutes/articles/Buttons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import ButtonsMd from "app/docs/buttons.md"
66

77
const Buttons = () => {
88
return (
9-
<React.Fragment>
9+
<>
1010
<SetMeta
1111
title="Buttons"
1212
description="Use button elements and class helpers for consistent interactions."
1313
/>
1414
<PageHeader>Buttons</PageHeader>
1515
<Article>{ButtonsMd}</Article>
16-
</React.Fragment>
16+
</>
1717
)
1818
}
1919

app/components/DocsRoutes/articles/Collapsibles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import CollapsiblesMd from "app/docs/collapsibles.md"
66

77
const Collapsibles = () => {
88
return (
9-
<React.Fragment>
9+
<>
1010
<SetMeta
1111
title="Collapsibles"
1212
description="A component for hiding or showing content in a collapsible container."
1313
/>
1414
<PageHeader>Collapsibles</PageHeader>
1515
<Article>{CollapsiblesMd}</Article>
16-
</React.Fragment>
16+
</>
1717
)
1818
}
1919

app/components/DocsRoutes/articles/Color.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import ColorMd from "app/docs/color.md"
66

77
const Color = () => {
88
return (
9-
<React.Fragment>
9+
<>
1010
<SetMeta
1111
title="Color"
1212
description="Utilities for adding custom colored text and backgrounds using class helpers."
1313
/>
1414
<PageHeader>Color</PageHeader>
1515
<Article>{ColorMd}</Article>
16-
</React.Fragment>
16+
</>
1717
)
1818
}
1919

0 commit comments

Comments
 (0)