@primer/doctocat-nextjs 0.5.0-rc.6ee882c → 0.5.0-rc.d69336a

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.
package/CHANGELOG.md CHANGED
@@ -29,6 +29,17 @@
29
29
  + <Theme sidebarLinks={sidebarLinks} {...rest} />
30
30
  ```
31
31
 
32
+ ### Patch Changes
33
+
34
+ - [#34](https://github.com/primer/doctocat-nextjs/pull/34) [`ccf198c`](https://github.com/primer/doctocat-nextjs/commit/ccf198cca25b1f021c5ae78b8e2760c141a77dcc) Thanks [@rezrah](https://github.com/rezrah)! - Collection of UI bugfixes:
35
+
36
+ - Sidebar offset added to prevent links being trapped under fixed header
37
+ - Narrow viewport overflow bug fixed
38
+ - Table of contents presentation fixed on narrow viewport, and has improved presentation on wider breakpoints.
39
+ - Frontmatter metadata presentation now fixed on narrow viewport
40
+ - OS scrollbar in dark color mode now respects color scheme
41
+ - Inverted margin spacing in markdown content to use `margin-block-end` instead of `margin-block-start` to fix inconsistent spacing
42
+
32
43
  ## 0.4.1
33
44
 
34
45
  ### Patch Changes
@@ -10,3 +10,4 @@ export {Article} from './layout/article/Article'
10
10
  export {HeadingLink} from './layout/heading-link/HeadingLinks'
11
11
  export {CodeBlock} from './layout/code-block/CodeBlock'
12
12
  export {PropTableValues} from './layout/prop-values/PropValues'
13
+ export {TableWrapper} from './table-wrapper/TableWrapper'
@@ -14,7 +14,14 @@
14
14
  order: 0;
15
15
  }
16
16
 
17
- @media screen and (min-width: 768px) {
17
+ @media screen and (max-width: 48rem) {
18
+ .Article--withToc {
19
+ display: flex; /* Prevents column overflow */
20
+ flex-direction: column;
21
+ }
22
+ }
23
+
24
+ @media screen and (min-width: 1023px) {
18
25
  .main {
19
26
  order: 0;
20
27
  }
@@ -27,3 +34,9 @@
27
34
  grid-template-columns: 1fr 200px;
28
35
  }
29
36
  }
37
+
38
+ @media screen and (min-width: 2048px) {
39
+ .Article--withToc {
40
+ grid-template-columns: 1fr;
41
+ }
42
+ }
@@ -35,7 +35,11 @@ export function Article({children, toc, metadata}: PropsWithChildren<Props>) {
35
35
  <div className={styles.main}>
36
36
  {hasMetadata ? (
37
37
  <Box marginBlockEnd={48}>
38
- <Stack padding="none" direction="horizontal" justifyContent="space-between">
38
+ <Stack
39
+ padding="none"
40
+ direction={{narrow: 'vertical', regular: 'horizontal'}}
41
+ justifyContent="space-between"
42
+ >
39
43
  {metadata.ready || metadata.a11yReviewed ? (
40
44
  <Stack direction="horizontal" gap={8} padding="none">
41
45
  {metadata.ready === true && <ReadinessLabel />}
@@ -117,12 +117,22 @@
117
117
  .Header__links {
118
118
  display: none;
119
119
  margin-inline: var(--base-size-24);
120
+ margin-block: 0;
121
+ padding: 0;
122
+ list-style: none;
123
+ gap: var(--base-size-2);
120
124
  }
121
125
 
122
126
  .Header__link {
123
127
  text-decoration: none;
124
128
  font-size: var(--base-font-size-16);
125
129
  font-weight: var(--base-font-weight-500);
130
+ padding: var(--base-size-6) var(--base-size-12);
131
+ border-radius: var(--brand-borderRadius-small);
132
+ }
133
+
134
+ .Header__link:hover {
135
+ background-color: var(--brand-color-canvas-subtle);
126
136
  }
127
137
 
128
138
  .Header__externalLinkIcon {
@@ -60,7 +60,7 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
60
60
  <div className={styles.Header__start}>
61
61
  <Link href="/" className={styles.Header__siteTitle}>
62
62
  <MarkGithubIcon size={24} />
63
- <Text className={styles.Header__siteTitleText} as="p" size="300" weight="semibold">
63
+ <Text className={styles.Header__siteTitleText} as="p" size="200" weight="semibold">
64
64
  {siteTitle}
65
65
  </Text>
66
66
  </Link>
@@ -70,28 +70,33 @@ export function Header({siteTitle, flatDocsDirectories, pageMap}: HeaderProps) {
70
70
  {headerLinks.length > 0 && <LinksDropdown className={styles.Header__linksDropdown} items={headerLinks} />}
71
71
  </div>
72
72
  <div className={styles.Header__end}>
73
- <Stack className={styles.Header__links} direction="horizontal" padding="none" gap={24}>
73
+ <ul className={styles.Header__links}>
74
74
  {headerLinks.map(link => (
75
- <Link
76
- key={link.href}
77
- className={styles.Header__link}
78
- href={link.href}
79
- aria-current={link.isActive ? 'page' : undefined}
80
- {...(link.isExternal && {target: '_blank', rel: 'noopener noreferrer'})}
81
- >
82
- <Text
83
- size="200"
84
- variant={link.isActive ? 'default' : 'muted'}
85
- weight={link.isActive ? 'semibold' : 'normal'}
75
+ <li key={link.href}>
76
+ <Link
77
+ className={styles.Header__link}
78
+ href={link.href}
79
+ aria-current={link.isActive ? 'page' : undefined}
80
+ {...(link.isExternal && {target: '_blank', rel: 'noopener noreferrer'})}
86
81
  >
87
- {link.title}
88
- {link.isExternal && (
89
- <ArrowUpRightIcon className={styles.Header__externalLinkIcon} size={10} aria-label="External link" />
90
- )}
91
- </Text>
92
- </Link>
82
+ <Text
83
+ size="200"
84
+ variant={link.isActive ? 'default' : 'muted'}
85
+ weight={link.isActive ? 'semibold' : 'normal'}
86
+ >
87
+ {link.title}
88
+ {link.isExternal && (
89
+ <ArrowUpRightIcon
90
+ className={styles.Header__externalLinkIcon}
91
+ size={10}
92
+ aria-label="External link"
93
+ />
94
+ )}
95
+ </Text>
96
+ </Link>
97
+ </li>
93
98
  ))}
94
- </Stack>
99
+ </ul>
95
100
  <div className={clsx(styles.Header__searchArea, isSearchOpen && styles['Header__searchArea--open'])}>
96
101
  <FocusOn enabled={isSearchOpen} onEscapeKey={closeSearch} onClickOutside={closeSearch}>
97
102
  <GlobalSearch
@@ -219,6 +219,7 @@ export function Theme({pageMap, children}: ThemeProps) {
219
219
  aria-label="Side navigation"
220
220
  width="small"
221
221
  sticky
222
+ offsetHeader={65}
222
223
  padding="none"
223
224
  position="start"
224
225
  hidden={{narrow: true}}
@@ -1,16 +1,17 @@
1
1
  .wrapper {
2
2
  position: sticky;
3
- top: 0;
3
+ top: 140px;
4
+ scroll-margin-top: 140px;
4
5
  }
5
6
 
6
7
  .heading {
7
8
  font-size: var(--base-size-12);
8
- padding-inline-start: var(--base-size-16);
9
9
  margin-block-end: var(--base-size-8);
10
10
  text-transform: uppercase;
11
11
  }
12
12
 
13
13
  .item {
14
+ margin-inline-start: 0 !important;
14
15
  margin-block-end: var(--base-size-4);
15
16
  transition: transform var(--brand-animation-duration-fast) var(--brand-animation-easing-default);
16
17
  }
@@ -18,3 +19,18 @@
18
19
  .item[aria-current='location'] {
19
20
  transform: translateX(var(--base-size-4));
20
21
  }
22
+
23
+ @media screen and (min-width: 2048px) {
24
+ .wrapper {
25
+ position: fixed;
26
+ display: flex;
27
+ flex-direction: column;
28
+ min-width: 280px;
29
+ right: 0;
30
+ overflow: auto;
31
+ padding: var(--base-size-40) var(--base-size-40) var(--base-size-40) 0;
32
+ top: 65px;
33
+ max-height: calc(100vh - 65px);
34
+ width: 220px;
35
+ }
36
+ }
@@ -0,0 +1,4 @@
1
+ .wrapper {
2
+ position: relative;
3
+ overflow: auto;
4
+ }
@@ -0,0 +1,6 @@
1
+ import React, {PropsWithChildren} from 'react'
2
+ import styles from './TableWrapper.module.css'
3
+
4
+ export function TableWrapper({children}: PropsWithChildren) {
5
+ return <div className={styles.wrapper}>{children}</div>
6
+ }
package/css/global.css CHANGED
@@ -9,6 +9,10 @@ body {
9
9
  'Segoe UI Emoji';
10
10
  }
11
11
 
12
+ [data-color-mode='dark'] {
13
+ color-scheme: dark;
14
+ }
15
+
12
16
  .exclude-from-prose,
13
17
  .exclude-from-prose * + * {
14
18
  margin-block-start: 0 !important;
@@ -33,11 +33,11 @@
33
33
  /* ---------------------------------------------------------- */
34
34
 
35
35
  .Prose
36
- :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, hr, table, pre, dl):not(
37
- :first-child,
38
- :global(.custom-component) :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, hr, table, pre, dl)
36
+ :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, hr, table, pre, dl, :global(.custom-component)):not(
37
+ :global(.custom-component)
38
+ :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, figure, hr, table, pre, dl, :global(.custom-component))
39
39
  ) {
40
- margin-block-start: var(--spacing, 1em);
40
+ margin-block-end: var(--spacing, 1em);
41
41
  }
42
42
 
43
43
  /* ---------------------------------------------------------- */
@@ -235,7 +235,7 @@
235
235
  display: block;
236
236
  max-width: 100%;
237
237
  height: auto;
238
- margin-block-start: var(--spacing);
238
+ margin-block-end: var(--spacing);
239
239
  }
240
240
 
241
241
  /* ---------------------------------------------------------- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/doctocat-nextjs",
3
- "version": "0.5.0-rc.6ee882c",
3
+ "version": "0.5.0-rc.d69336a",
4
4
  "description": "A Next.js theme for building Primer documentation sites",
5
5
  "main": "index.js",
6
6
  "type": "module",