Skip to content

Commit 939b092

Browse files
authored
Merge pull request #249 from qualcomm/dev
navDensity
2 parents d51677c + 7190e19 commit 939b092

9 files changed

Lines changed: 47 additions & 23 deletions

File tree

packages/frameworks/react-mdx/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @qualcomm-ui/react-mdx Changelog
22

3+
## 2.6.0
4+
5+
Apr 28th, 2026
6+
7+
### Features
8+
9+
- [docs-layout]: add NavDensity type and prop, defaults to "compact" ([4cd65b5](https://github.com/qualcomm/qualcomm-ui/commit/4cd65b5))
10+
- [sidebar]: integrate navDensity from context ([9636533](https://github.com/qualcomm/qualcomm-ui/commit/9636533))
11+
312
## 2.5.0
413

514
Apr 23rd, 2026

packages/frameworks/react-mdx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qualcomm-ui/react-mdx",
3-
"version": "2.5.0",
3+
"version": "2.6.0",
44
"description": "React components and utilities for MDX documentation sites based on QUI Docs",
55
"author": "Ryan Bower",
66
"license": "BSD-3-Clause-Clear",

packages/frameworks/react-mdx/src/docs-layout/docs-layout.css

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@
133133
height: 100%;
134134
}
135135

136-
/* TODO: remove when the small side nav size lands */
137-
.qui-side-nav__node-root {
138-
height: 32px;
139-
min-height: 32px;
140-
141-
&:has(+ .qui-side-nav__node-root),
142-
&:has(+ .qui-side-nav__branch-root) {
143-
margin-bottom: 1px;
136+
&[data-nav-density="compact"] {
137+
/* TODO: remove when the small side nav size lands */
138+
.qui-side-nav__node-root {
139+
height: 32px;
140+
min-height: 32px;
141+
142+
&:has(+ .qui-side-nav__node-root),
143+
&:has(+ .qui-side-nav__branch-root) {
144+
margin-bottom: 1px;
145+
}
144146
}
145147
}
146148

packages/frameworks/react-mdx/src/docs-layout/layout/root.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function Root({
4444
docProps,
4545
hideToc,
4646
mdxComponents,
47+
navDensity = "compact",
4748
onDemoSettingsChange,
4849
onDemoStateChange,
4950
onPackageManagerChange,
@@ -136,6 +137,7 @@ export function Root({
136137
hidePageLinks,
137138
hideSideNav,
138139
mainContentElement,
140+
navDensity,
139141
navItems,
140142
pageExport,
141143
pageFrontmatter: pageData?.data ?? {},
@@ -149,14 +151,18 @@ export function Root({
149151
}, [
150152
exports,
151153
hideToc,
154+
navDensity,
152155
mainContentElement,
153156
navItems,
154157
pageDocProps,
155158
pageMap,
156159
pathname,
157160
])
158161

159-
const mergedProps = mergeProps({className: "qui-docs__root"}, props)
162+
const mergedProps = mergeProps(
163+
{className: "qui-docs__root", "data-nav-density": navDensity},
164+
props,
165+
)
160166

161167
return (
162168
<MdxDocsProvider value={mdxDocsContextValue}>

packages/frameworks/react-mdx/src/docs-layout/layout/sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function Sidebar({
6262
...props
6363
}: SidebarProps): ReactElement {
6464
const ref = useRef<HTMLDivElement | null>(null)
65-
const {navItems, pathname} = useMdxDocsLayoutContext()
65+
const {navDensity, navItems, pathname} = useMdxDocsLayoutContext()
6666
const {renderLink: RenderLink} = useMdxDocsContext()
6767

6868
const initialCollection = useMemo(
@@ -213,7 +213,7 @@ export function Sidebar({
213213
}, [scrollIntoView])
214214

215215
const mergedProps = mergeProps(
216-
{className: "qui-docs-sidebar__root", ref},
216+
{className: "qui-docs-sidebar__root", "data-nav-density": navDensity, ref},
217217
props,
218218
)
219219

packages/frameworks/react-mdx/src/docs-layout/layout/use-mdx-docs-layout.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ import type {
1717
} from "@qualcomm-ui/mdx-common"
1818
import type {PropsContextValue} from "@qualcomm-ui/react-mdx/typedoc"
1919

20+
import type {NavDensity} from "../types"
21+
2022
export interface MdxDocsLayoutContextState {
2123
hidePageLinks: boolean
2224
hideSideNav: boolean
2325
mainContentElement: HTMLElement | null
26+
navDensity: NavDensity
2427
navItems: NavItem[]
2528
pageExport: boolean | KnowledgePageData | undefined
2629
pageFrontmatter: Record<string, unknown>

packages/frameworks/react-mdx/src/docs-layout/types.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,20 @@ export type TocHighlightStrategy = "nearest" | "viewport"
2121

2222
/**
2323
* The function used to render the application's clientside link component.
24-
*
25-
* @public
2624
*/
2725
export type RenderLink = (
2826
props: HTMLAttributes<HTMLAnchorElement> & {href: string},
2927
) => ReactNode
3028

31-
/**
32-
* @public
33-
*/
3429
export interface DocPropsSettings {
3530
/**
3631
* URL for the changelog, used by the `@since` tags.
3732
*/
3833
changelogUrl?: string
3934
}
4035

41-
/**
42-
* @public
43-
*/
36+
export type NavDensity = "compact" | "comfy"
37+
4438
export interface DocsLayoutSettings extends Pick<
4539
MdxDocsContextValue,
4640
"demoSettings" | "packageManager" | "ssrUserAgent"
@@ -81,6 +75,16 @@ export interface DocsLayoutSettings extends Pick<
8175
*/
8276
mdxComponents?: ReturnType<typeof useMDXComponents>
8377

78+
/**
79+
* Governs sidebar nav item padding and size.
80+
*
81+
* @option `compact`: sidebar nav items render with reduced padding.
82+
* @option 'comfy': sidebar nav items render with increased padding.
83+
*
84+
* @default 'compact'
85+
*/
86+
navDensity?: NavDensity
87+
8488
/**
8589
* Function fired when the demo settings change.
8690
*/

packages/frameworks/react-swagger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@qualcomm-ui/qds-core": "workspace:^1.26.1",
4949
"@qualcomm-ui/react": "workspace:^1.20.3",
5050
"@qualcomm-ui/react-core": "workspace:^1.4.3",
51-
"@qualcomm-ui/react-mdx": "workspace:^2.5.0",
51+
"@qualcomm-ui/react-mdx": "workspace:^2.6.0",
5252
"@qualcomm-ui/react-test-utils": "workspace:^1.0.1",
5353
"@qualcomm-ui/tsconfig": "catalog:",
5454
"@qualcomm-ui/utils": "workspace:^1.2.3",

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)