@primer/doctocat-nextjs 0.0.0-20251114193003 → 0.0.0-20251124211620
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 +3 -3
- package/components/content/caption/Caption.module.css +6 -0
- package/components/content/caption/Caption.tsx +7 -2
- package/components/content/dos-and-donts/DosAndDonts.tsx +2 -8
- package/components/layout/code-block/CodeBlock.module.css +5 -0
- package/components/layout/nav-drawer/Drawer.module.css +19 -0
- package/components/layout/nav-drawer/Drawer.tsx +6 -9
- package/components/layout/root-layout/Theme.module.css +35 -0
- package/components/layout/root-layout/Theme.tsx +15 -25
- package/components/layout/sidebar/Sidebar.tsx +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# @primer/doctocat-nextjs
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20251124211620
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Fake entry to force publishing
|
|
8
8
|
|
|
9
|
-
## 0.0.0-
|
|
9
|
+
## 0.0.0-20251124211618
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
-
- [#
|
|
13
|
+
- [#68](https://github.com/primer/doctocat-nextjs/pull/68) [`b75584e`](https://github.com/primer/doctocat-nextjs/commit/b75584edb6936a70ea94925fc743989422cc3d9a) Thanks [@janmaarten-a11y](https://github.com/janmaarten-a11y)! - Improve screen reader accessibility by updating sidebar navigation heading hierarchy. The sidebar title now uses a semantic `<Heading>` component with visually hidden text to clarify it's a navigation area, and is properly connected to the `<NavList>` via `aria-labelledby`.
|
|
14
14
|
|
|
15
15
|
## 0.7.0
|
|
16
16
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React, {PropsWithChildren} from 'react'
|
|
2
|
-
import
|
|
2
|
+
import styles from './Caption.module.css'
|
|
3
3
|
|
|
4
4
|
export function Caption(props: PropsWithChildren) {
|
|
5
|
-
|
|
5
|
+
const {children, ...rest} = props
|
|
6
|
+
return (
|
|
7
|
+
<span className={styles.Caption} {...rest}>
|
|
8
|
+
{children}
|
|
9
|
+
</span>
|
|
10
|
+
)
|
|
6
11
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {Box} from '@primer/react'
|
|
3
2
|
import clsx from 'clsx'
|
|
4
3
|
import styles from './DosAndDonts.module.css'
|
|
5
4
|
|
|
@@ -39,14 +38,9 @@ type DoDontBaseProps = {
|
|
|
39
38
|
export function DoDontBase({children, title, indented, className, ...rest}: React.PropsWithChildren<DoDontBaseProps>) {
|
|
40
39
|
return (
|
|
41
40
|
<div className={clsx(`exclude-from-prose`, styles.doDontBase, className)} {...rest}>
|
|
42
|
-
<
|
|
43
|
-
className={styles.header}
|
|
44
|
-
sx={{
|
|
45
|
-
color: 'var(--fgColor-onEmphasis, var(--color-fg-on-emphasis))',
|
|
46
|
-
}}
|
|
47
|
-
>
|
|
41
|
+
<div className={styles.header} style={{color: 'var(--fgColor-onEmphasis, var(--color-fg-on-emphasis))'}}>
|
|
48
42
|
<span className={styles.headerText}>{title}</span>
|
|
49
|
-
</
|
|
43
|
+
</div>
|
|
50
44
|
<div className={styles.content}>
|
|
51
45
|
{indented ? (
|
|
52
46
|
<blockquote className={styles.indentedContent} style={{borderLeftColor: 'var(--brand-color-border-default)'}}>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.DrawerOverlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
background: rgba(0, 0, 0, 0.5);
|
|
5
|
+
z-index: 1;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.DrawerPanel {
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
width: 300px;
|
|
14
|
+
background: var(--brand-color-canvas-default, var(--color-canvas-default));
|
|
15
|
+
z-index: 1;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {PropsWithChildren} from 'react'
|
|
2
|
-
import {Box} from '@primer/react'
|
|
3
2
|
import {AnimatePresence, motion} from 'framer-motion'
|
|
4
3
|
import {FocusOn} from 'react-focus-on'
|
|
4
|
+
import styles from './Drawer.module.css'
|
|
5
5
|
|
|
6
6
|
type Drawer = {
|
|
7
7
|
isOpen: boolean
|
|
@@ -22,29 +22,26 @@ export function Drawer({isOpen, onDismiss, children}: PropsWithChildren<Drawer>)
|
|
|
22
22
|
tabIndex={0}
|
|
23
23
|
>
|
|
24
24
|
<FocusOn returnFocus={true} onEscapeKey={() => onDismiss()}>
|
|
25
|
-
<
|
|
25
|
+
<motion.div
|
|
26
26
|
key="overlay"
|
|
27
|
-
|
|
27
|
+
className={styles.DrawerOverlay}
|
|
28
28
|
initial={{opacity: 0}}
|
|
29
29
|
animate={{opacity: 1}}
|
|
30
30
|
exit={{opacity: 0}}
|
|
31
31
|
transition={{type: 'tween'}}
|
|
32
32
|
onClick={() => onDismiss()}
|
|
33
|
-
sx={{top: 0, right: 0, bottom: 0, left: 0, bg: 'rgba(0, 0, 0, 0.5)', position: 'fixed', zIndex: 1}}
|
|
34
33
|
/>
|
|
35
34
|
|
|
36
|
-
<
|
|
35
|
+
<motion.div
|
|
37
36
|
key="drawer"
|
|
38
|
-
|
|
37
|
+
className={styles.DrawerPanel}
|
|
39
38
|
initial={{x: '100%'}}
|
|
40
39
|
animate={{x: 0}}
|
|
41
40
|
exit={{x: '100%'}}
|
|
42
41
|
transition={{type: 'tween', duration: 0.2}}
|
|
43
|
-
style={{zIndex: 1}}
|
|
44
|
-
sx={{width: 300, top: 0, right: 0, bottom: 0, bg: 'gray.0', position: 'fixed'}}
|
|
45
42
|
>
|
|
46
43
|
{children}
|
|
47
|
-
</
|
|
44
|
+
</motion.div>
|
|
48
45
|
</FocusOn>
|
|
49
46
|
</div>
|
|
50
47
|
) : null}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.StickyHeader {
|
|
2
|
+
position: sticky;
|
|
3
|
+
top: 0;
|
|
4
|
+
z-index: 99;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.ContentContainer {
|
|
8
|
+
max-width: 1200px;
|
|
9
|
+
width: 100%;
|
|
10
|
+
margin: 0 auto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.BreadcrumbRoot,
|
|
14
|
+
.BreadcrumbItem {
|
|
15
|
+
color: var(--brand-InlineLink-color-rest);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.BreadcrumbItem {
|
|
19
|
+
text-transform: capitalize;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.HeroImageWrapper {
|
|
23
|
+
padding-block-start: var(--base-size-16);
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
.ActionsWrapper {
|
|
29
|
+
padding-block-start: var(--base-size-16);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
.RelatedLinks {
|
|
34
|
+
padding-top: var(--base-size-20);
|
|
35
|
+
}
|
|
@@ -4,7 +4,7 @@ import NextLink from 'next/link'
|
|
|
4
4
|
import Head from 'next/head'
|
|
5
5
|
import type {Folder, MdxFile, PageMapItem} from 'nextra'
|
|
6
6
|
import {useFSRoute} from 'nextra/hooks'
|
|
7
|
-
import {BaseStyles,
|
|
7
|
+
import {BaseStyles, Breadcrumbs, PageLayout, ThemeProvider} from '@primer/react'
|
|
8
8
|
import '@primer/primitives/dist/css/functional/themes/light.css'
|
|
9
9
|
import '@primer/primitives/dist/css/functional/themes/dark.css'
|
|
10
10
|
import {
|
|
@@ -119,16 +119,10 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
119
119
|
</Head>
|
|
120
120
|
|
|
121
121
|
<ContentWrapper disableAnimations={disablePageAnimation}>
|
|
122
|
-
<
|
|
123
|
-
sx={{
|
|
124
|
-
position: 'sticky',
|
|
125
|
-
top: 0,
|
|
126
|
-
zIndex: 99,
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
122
|
+
<div style={{position: 'sticky', top: 0, zIndex: 99}}>
|
|
129
123
|
<SkipToMainContent href="#main">Skip to main content</SkipToMainContent>
|
|
130
124
|
<Header flatDocsDirectories={flatDocsDirectories} siteTitle={siteTitle} pageMap={pageMap} />
|
|
131
|
-
</
|
|
125
|
+
</div>
|
|
132
126
|
<PageLayout rowGap="none" columnGap="none" padding="none" containerWidth="full">
|
|
133
127
|
<PageLayout.Pane
|
|
134
128
|
width="small"
|
|
@@ -145,7 +139,7 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
145
139
|
</PageLayout.Pane>
|
|
146
140
|
<PageLayout.Content padding="normal">
|
|
147
141
|
<div id="main">
|
|
148
|
-
<
|
|
142
|
+
<div style={!isHomePage ? {maxWidth: 1200, width: '100%', margin: '0 auto'} : undefined}>
|
|
149
143
|
<Stack direction="vertical" padding="none" gap="spacious">
|
|
150
144
|
{!isHomePage && (
|
|
151
145
|
<>
|
|
@@ -155,9 +149,7 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
155
149
|
<Breadcrumbs.Item
|
|
156
150
|
as={NextLink}
|
|
157
151
|
href="/"
|
|
158
|
-
|
|
159
|
-
color: 'var(--brand-InlineLink-color-rest)',
|
|
160
|
-
}}
|
|
152
|
+
style={{color: 'var(--brand-InlineLink-color-rest)'}}
|
|
161
153
|
>
|
|
162
154
|
{activeHeaderLink ? activeHeaderLink.title : siteTitle}
|
|
163
155
|
</Breadcrumbs.Item>
|
|
@@ -166,8 +158,6 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
166
158
|
.filter((item, index, array) => {
|
|
167
159
|
const nextItem = array[index + 1]
|
|
168
160
|
|
|
169
|
-
// Skip when current item is a folder followed by its index page
|
|
170
|
-
// or when it is an index page with a tabbed navigation
|
|
171
161
|
return !(
|
|
172
162
|
(index < array.length - 1 &&
|
|
173
163
|
nextItem.name === 'index' &&
|
|
@@ -192,7 +182,7 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
192
182
|
key={item.name}
|
|
193
183
|
href={item.route}
|
|
194
184
|
selected={isLastItem}
|
|
195
|
-
|
|
185
|
+
style={{
|
|
196
186
|
textTransform: 'capitalize',
|
|
197
187
|
color: 'var(--brand-InlineLink-color-rest)',
|
|
198
188
|
}}
|
|
@@ -204,7 +194,7 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
204
194
|
</Breadcrumbs>
|
|
205
195
|
)}
|
|
206
196
|
|
|
207
|
-
<
|
|
197
|
+
<div>
|
|
208
198
|
<Stack direction="vertical" padding="none" gap={12} alignItems="flex-start">
|
|
209
199
|
{activeMetadata.title && (
|
|
210
200
|
<Heading as="h1" size="3">
|
|
@@ -217,12 +207,12 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
217
207
|
</Text>
|
|
218
208
|
)}
|
|
219
209
|
{activeMetadata.image && (
|
|
220
|
-
<
|
|
210
|
+
<div style={{paddingBlockStart: 'var(--base-size-16)', width: '100%'}}>
|
|
221
211
|
<Hero.Image src={activeMetadata.image} alt={activeMetadata['image-alt']} />
|
|
222
|
-
</
|
|
212
|
+
</div>
|
|
223
213
|
)}
|
|
224
214
|
{activeMetadata['action-1-text'] && (
|
|
225
|
-
<
|
|
215
|
+
<div style={{paddingBlockStart: 'var(--base-size-16)'}}>
|
|
226
216
|
<ButtonGroup>
|
|
227
217
|
<Button as="a" href={activeMetadata['action-1-link']}>
|
|
228
218
|
{activeMetadata['action-1-text']}
|
|
@@ -233,10 +223,10 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
233
223
|
</Button>
|
|
234
224
|
)}
|
|
235
225
|
</ButtonGroup>
|
|
236
|
-
</
|
|
226
|
+
</div>
|
|
237
227
|
)}
|
|
238
228
|
</Stack>
|
|
239
|
-
</
|
|
229
|
+
</div>
|
|
240
230
|
{activeMetadata['show-tabs'] && <UnderlineNav tabData={filteredTabData} />}
|
|
241
231
|
</>
|
|
242
232
|
)}
|
|
@@ -248,16 +238,16 @@ export function Theme({pageMap, children}: ThemeProps) {
|
|
|
248
238
|
<>{children}</>
|
|
249
239
|
|
|
250
240
|
{relatedLinks.length > 0 && (
|
|
251
|
-
<
|
|
241
|
+
<div style={{paddingTop: 'var(--base-size-20)'}}>
|
|
252
242
|
<RelatedContentLinks links={relatedLinks} />
|
|
253
|
-
</
|
|
243
|
+
</div>
|
|
254
244
|
)}
|
|
255
245
|
</>
|
|
256
246
|
)}
|
|
257
247
|
</article>
|
|
258
248
|
<Footer filePath={filePath} repoURL={repoURL} repoSrcPath={repoSrcPath} />
|
|
259
249
|
</Stack>
|
|
260
|
-
</
|
|
250
|
+
</div>
|
|
261
251
|
</div>
|
|
262
252
|
</PageLayout.Content>
|
|
263
253
|
</PageLayout>
|
|
@@ -77,7 +77,7 @@ export function Sidebar({pageMap}: SidebarProps) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<NavList.Group title={subNavName} key={item.name}
|
|
80
|
+
<NavList.Group title={subNavName} key={item.name} style={{marginBottom: 'var(--base-size-24)'}}>
|
|
81
81
|
<NavList.GroupHeading as="h3">
|
|
82
82
|
<NextLink href={item.route}>{subNavName}</NextLink>
|
|
83
83
|
</NavList.GroupHeading>
|
|
@@ -142,7 +142,7 @@ export function Sidebar({pageMap}: SidebarProps) {
|
|
|
142
142
|
as={NextLink}
|
|
143
143
|
key={landingPageItem.route}
|
|
144
144
|
href={landingPageItem.route}
|
|
145
|
-
|
|
145
|
+
style={{textTransform: 'capitalize'}}
|
|
146
146
|
aria-current={isCurrentOrChild ? 'page' : undefined}
|
|
147
147
|
className={styles.NavListItem}
|
|
148
148
|
>
|
|
@@ -155,7 +155,7 @@ export function Sidebar({pageMap}: SidebarProps) {
|
|
|
155
155
|
)
|
|
156
156
|
})}
|
|
157
157
|
{sidebarLinks.length > 0 && (
|
|
158
|
-
<NavList.Group title=""
|
|
158
|
+
<NavList.Group title="" style={{marginBottom: 'var(--base-size-24)'}}>
|
|
159
159
|
{sidebarLinks.map(link => {
|
|
160
160
|
return (
|
|
161
161
|
<NavList.Item
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/doctocat-nextjs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20251124211620",
|
|
4
4
|
"description": "A Next.js theme for building Primer documentation sites",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@next/mdx": "15.5.2",
|
|
29
29
|
"@primer/octicons-react": "19.15.1",
|
|
30
|
-
"@primer/react": "^
|
|
30
|
+
"@primer/react": "^38.0.0",
|
|
31
31
|
"@types/lodash.debounce": "^4.0.9",
|
|
32
32
|
"framer-motion": "12.4.0",
|
|
33
33
|
"lodash.debounce": "^4.0.8",
|