@primer/gatsby-theme-doctocat 3.2.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.eslintrc.json +2 -1
  2. package/CHANGELOG.md +40 -1
  3. package/babel.config.js +11 -1
  4. package/gatsby-node.js +2 -2
  5. package/jest.config.js +2 -1
  6. package/package.json +11 -11
  7. package/setup-tests.js +9 -0
  8. package/src/components/caption.js +2 -2
  9. package/src/components/clipboard-copy.js +1 -1
  10. package/src/components/code.js +11 -14
  11. package/src/components/container.js +2 -2
  12. package/src/components/contributors.js +4 -4
  13. package/src/components/details.js +1 -1
  14. package/src/components/do-dont.js +37 -14
  15. package/src/components/drawer.js +6 -6
  16. package/src/components/header.js +20 -16
  17. package/src/components/heading.js +1 -1
  18. package/src/components/hero-layout.js +8 -8
  19. package/src/components/hero.js +3 -3
  20. package/src/components/image-container.js +13 -4
  21. package/src/components/layout.js +41 -34
  22. package/src/components/link.js +10 -0
  23. package/src/components/live-code.js +15 -11
  24. package/src/components/live-preview-wrapper.js +2 -2
  25. package/src/components/mobile-search.js +19 -10
  26. package/src/components/nav-drawer.js +50 -23
  27. package/src/components/nav-dropdown.js +11 -9
  28. package/src/components/nav-items.js +37 -59
  29. package/src/components/page-footer.js +15 -5
  30. package/src/components/search-results.js +6 -11
  31. package/src/components/search.js +11 -9
  32. package/src/components/sidebar.js +17 -10
  33. package/src/components/skip-link.js +1 -1
  34. package/src/components/source-link.js +2 -4
  35. package/src/components/status-label.js +1 -1
  36. package/src/components/storybook-link.js +2 -4
  37. package/src/components/table-of-contents.js +8 -20
  38. package/src/components/table.js +1 -0
  39. package/src/components/text-input.js +2 -2
  40. package/src/components/wrap-page-element.js +1 -1
  41. package/src/components/wrap-root-element.js +2 -1
  42. package/src/search.worker.js +1 -1
@@ -1,11 +1,11 @@
1
- import {BorderBox, Position, ThemeProvider} from '@primer/components'
1
+ import {Box, ThemeProvider} from '@primer/react'
2
2
  import Downshift from 'downshift'
3
3
  import {navigate} from 'gatsby'
4
4
  import React from 'react'
5
5
  import useSearch from '../use-search'
6
6
  import useSiteMetadata from '../use-site-metadata'
7
- import TextInput from './text-input'
8
7
  import SearchResults from './search-results'
8
+ import TextInput from './text-input'
9
9
 
10
10
  function stateReducer(state, changes) {
11
11
  switch (changes.type) {
@@ -44,7 +44,7 @@ function Search() {
44
44
  stateReducer={stateReducer}
45
45
  >
46
46
  {({getInputProps, getItemProps, getMenuProps, getRootProps, isOpen, highlightedIndex}) => (
47
- <Position {...getRootProps({position: 'relative'})}>
47
+ <Box {...getRootProps({position: 'relative'})}>
48
48
  <TextInput
49
49
  {...getInputProps({
50
50
  placeholder: `Search ${siteMetadata.title}`,
@@ -54,7 +54,7 @@ function Search() {
54
54
  })}
55
55
  />
56
56
  {isOpen ? (
57
- <Position
57
+ <Box
58
58
  {...getMenuProps({
59
59
  position: 'absolute',
60
60
  left: 0,
@@ -63,7 +63,7 @@ function Search() {
63
63
  })}
64
64
  >
65
65
  <ThemeProvider colorMode="day">
66
- <BorderBox
66
+ <Box
67
67
  style={{overflow: 'auto'}}
68
68
  sx={{
69
69
  minWidth: 300,
@@ -72,15 +72,17 @@ function Search() {
72
72
  boxShadow: 'shadow.large',
73
73
  borderColor: 'border.muted',
74
74
  bg: 'canvas.overlay',
75
- borderRadius: '12px'
75
+ borderRadius: '12px',
76
+ borderWidth: '1px',
77
+ borderStyle: 'solid'
76
78
  }}
77
79
  >
78
80
  <SearchResults results={results} getItemProps={getItemProps} highlightedIndex={highlightedIndex} />
79
- </BorderBox>
81
+ </Box>
80
82
  </ThemeProvider>
81
- </Position>
83
+ </Box>
82
84
  ) : null}
83
- </Position>
85
+ </Box>
84
86
  )}
85
87
  </Downshift>
86
88
  )
@@ -1,4 +1,4 @@
1
- import {BorderBox, Flex, Position} from '@primer/components'
1
+ import {Box} from '@primer/react'
2
2
  import React from 'react'
3
3
  import navItems from '../nav.yml'
4
4
  import {HEADER_HEIGHT} from './header'
@@ -32,25 +32,32 @@ function Sidebar() {
32
32
  const scrollContainerProps = usePersistentScroll('sidebar')
33
33
 
34
34
  return (
35
- <Position
35
+ <Box
36
36
  sx={{
37
37
  position: 'sticky',
38
38
  top: HEADER_HEIGHT,
39
39
  height: `calc(100vh - ${HEADER_HEIGHT}px)`,
40
- minWidth: 260,
41
- bg: 'canvas.subtle'
40
+ minWidth: 260
42
41
  }}
43
42
  >
44
- <BorderBox
43
+ <Box
45
44
  {...scrollContainerProps}
46
45
  style={{overflow: 'auto'}}
47
- sx={{borderWidth: 0, borderRightWidth: 1, borderRadius: 0, height: '100%'}}
46
+ sx={{
47
+ borderWidth: 0,
48
+ borderRightWidth: 1,
49
+ borderRadius: 0,
50
+ height: '100%',
51
+ borderStyle: 'solid',
52
+ borderColor: 'border.subtle',
53
+ px: 2
54
+ }}
48
55
  >
49
- <Flex sx={{flexDirection: 'column'}}>
56
+ <Box sx={{flexDirection: 'column', display: 'flex'}}>
50
57
  <NavItems items={navItems} />
51
- </Flex>
52
- </BorderBox>
53
- </Position>
58
+ </Box>
59
+ </Box>
60
+ </Box>
54
61
  )
55
62
  }
56
63
 
@@ -1,4 +1,4 @@
1
- import {Link} from '@primer/components'
1
+ import {Link} from '@primer/react'
2
2
  import styled from 'styled-components'
3
3
  import React from 'react'
4
4
 
@@ -1,4 +1,4 @@
1
- import {Link, Text} from '@primer/components'
1
+ import {Link, Text} from '@primer/react'
2
2
  import {MarkGithubIcon} from '@primer/octicons-react'
3
3
  import React from 'react'
4
4
 
@@ -6,9 +6,7 @@ function SourceLink({href}) {
6
6
  return (
7
7
  <Link href={href}>
8
8
  <MarkGithubIcon />
9
- <Text ml={2} display="inline-block">
10
- View source
11
- </Text>
9
+ <Text sx={{ml: 2, display: 'inline-block'}}>View source</Text>
12
10
  </Link>
13
11
  )
14
12
  }
@@ -1,4 +1,4 @@
1
- import {Label} from '@primer/components'
1
+ import {Label} from '@primer/react'
2
2
  import React from 'react'
3
3
 
4
4
  const STATUS_COLORS = {
@@ -1,13 +1,11 @@
1
- import {Link, Text} from '@primer/components'
1
+ import {Link, Text} from '@primer/react'
2
2
  import React from 'react'
3
3
 
4
4
  function SourceLink({href}) {
5
5
  return (
6
6
  <Link href={href}>
7
7
  <StorybookIcon />
8
- <Text ml={2} display="inline-block">
9
- View storybook
10
- </Text>
8
+ <Text sx={{ml: 2, display: 'inline-block'}}>View storybook</Text>
11
9
  </Link>
12
10
  )
13
11
  }
@@ -1,28 +1,16 @@
1
- import {Box, Link} from '@primer/components'
1
+ import {Box, Link} from '@primer/react'
2
2
  import React from 'react'
3
+ import {NavList} from '@primer/react/drafts'
3
4
 
4
- function TableOfContents({items, depth}) {
5
+ function TableOfContents({'aria-labelledby': ariaLabelledBy, items, depth}) {
5
6
  return (
6
- <Box as="ul" m={0} p={0} css={{listStyle: 'none'}}>
7
+ <NavList aria-labelledby={ariaLabelledBy}>
7
8
  {items.map(item => (
8
- <Box as="li" key={item.url} pl={depth > 0 ? 3 : 0}>
9
- {item.title ? (
10
- <Link
11
- href={item.url}
12
- sx={{
13
- display: 'inline-block',
14
- py: 1,
15
- fontSize: [2, null, 1],
16
- color: 'fg.muted'
17
- }}
18
- >
19
- {item.title}
20
- </Link>
21
- ) : null}
22
- {item.items ? <TableOfContents items={item.items} depth={depth + 1} /> : null}
23
- </Box>
9
+ <NavList.Item key={item.title} href={item.url}>
10
+ {item.title}
11
+ </NavList.Item>
24
12
  ))}
25
- </Box>
13
+ </NavList>
26
14
  )
27
15
  }
28
16
 
@@ -28,6 +28,7 @@ const Table = styled.table`
28
28
 
29
29
  img {
30
30
  background-color: transparent;
31
+ vertical-align: middle;
31
32
  }
32
33
  `
33
34
 
@@ -1,10 +1,10 @@
1
- import {TextInput as PrimerTextInput, themeGet} from '@primer/components'
1
+ import {TextInput as PrimerTextInput, themeGet} from '@primer/react'
2
2
  import styled from 'styled-components'
3
3
 
4
4
  const TextInput = styled(PrimerTextInput)`
5
5
  /* The font-size of inputs should never be less than 16px.
6
6
  * Otherwise, iOS browsers will zoom in when the input is focused.
7
- * TODO: Update font-size of TextInput in @primer/components.
7
+ * TODO: Update font-size of TextInput in @primer/react.
8
8
  */
9
9
  font-size: ${themeGet('fontSizes.2')} !important;
10
10
  `
@@ -1,4 +1,4 @@
1
- import {BaseStyles, themeGet} from '@primer/components'
1
+ import {BaseStyles, themeGet} from '@primer/react'
2
2
  import React from 'react'
3
3
  import {createGlobalStyle} from 'styled-components'
4
4
  import SkipLink from './skip-link'
@@ -1,5 +1,6 @@
1
1
  import {MDXProvider} from '@mdx-js/react'
2
- import {Link, ThemeProvider} from '@primer/components'
2
+ import {ThemeProvider} from '@primer/react'
3
+ import Link from './link'
3
4
  import React from 'react'
4
5
  import mdxComponents from '../mdx-components'
5
6
  import Blockquote from './blockquote'
@@ -3,7 +3,7 @@ import debounce from 'lodash.debounce'
3
3
  ;(function searchWorker() {
4
4
  let fuse = null
5
5
 
6
- // [MKT]: I landed on the debouce wait value of 50 based mostly on
6
+ // [MKT]: I landed on the debounce wait value of 50 based mostly on
7
7
  // experimentation. With both `leading` and `trailing` set to `true`, this
8
8
  // feels pretty snappy.
9
9
  //