Skip to content

Commit 3e148d0

Browse files
authored
fix(components): Re-add exclude functionality in PageGrid (#11510)
1 parent 261475d commit 3e148d0

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

docs/contributing/pages/components.mdx

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ See also the [Note component](#note).
4141

4242
Render an expandable section.
4343

44-
<Expandable title="This is a title">
45-
This is some content
46-
</Expandable>
44+
<Expandable title="This is a title">This is some content</Expandable>
4745

4846
```markdown {tabTitle:Example}
4947
<Expandable title="This is a title">
@@ -110,6 +108,7 @@ You can also highlight diffs using the `diff` language:
110108
+ plus one
111109
```
112110
````
111+
113112
If you want to preserve syntax highlighting, you can add `diff` metadata to any code block
114113
then annotate the diff with `+` and `-`:
115114

@@ -193,6 +192,7 @@ Attributes:
193192

194193
- `header` (string) - optional header value to include, rendered as an H2
195194
- `nextPages` (boolean) - only render pages which come next based on sidebar ordering
195+
- `exclude` (string[]) - an array of pages to exclude from the grid. Specify the file name of the page, for example, `"index"` for `index.mdx`.
196196

197197
## PlatformContent
198198

@@ -281,15 +281,11 @@ You can specify multiple features by separating them with a comma:
281281

282282
The range visibility will be controlled by the `OnboardingOptionButtons` component:
283283

284-
````jsx diff
284+
```jsx diff
285285
<OnboardingOptionButtons
286-
options={[
287-
'error-monitoring',
288-
"profiling",
289-
"performance",
290-
]}
286+
options={["error-monitoring", "profiling", "performance"]}
291287
/>
292-
````
288+
```
293289

294290
- `options` can either be either an object of this shape:
295291

@@ -300,22 +296,20 @@ The range visibility will be controlled by the `OnboardingOptionButtons` compone
300296
checked: boolean
301297
}
302298
```
299+
303300
or a string (one of these `id`s 👆) for convenience when using defaults.
304301

305302
<Alert level="warning" title="Important">
306-
The underlying implementation relies on the `onboardingOptions` metadata in the code blocks to be valid JSON syntax.
303+
The underlying implementation relies on the `onboardingOptions` metadata in
304+
the code blocks to be valid JSON syntax.
307305
</Alert>
308306

309307
- default values: `checked: false` and `disabled: false` (`true` for `error-monitoring`).
310308

311309
Example (output of the above):
312310

313311
<OnboardingOptionButtons
314-
options={[
315-
"error-monitoring",
316-
"performance",
317-
"profiling",
318-
]}
312+
options={["error-monitoring", "performance", "profiling"]}
319313
dontStick
320314
/>
321315

@@ -367,29 +361,32 @@ Or you can use the `hideForThisOption` prop to hide the content for the selected
367361
Hide this section for `profiling` option.
368362
</OnboardingOption>
369363
```
370-
``````
364+
````
371365

372366
Example:
367+
373368
- toggle the `performance` option above to see the effect:
374369

375370
<OnboardingOption optionId="performance">
376371

377-
```jsx
378-
<OnboardingOption optionId="performance">
379-
This code block is wrapped in a `OnboardingOption` component and will only
380-
be rendered when the `performance` option is selected.
381-
</OnboardingOption>
382-
```
372+
```jsx
373+
<OnboardingOption optionId="performance">
374+
This code block is wrapped in a `OnboardingOption` component and will only
375+
be rendered when the `performance` option is selected.
376+
</OnboardingOption>
377+
```
378+
383379
</OnboardingOption>
384380

385381
- toggle the `profiling` option above to see the effect:
386382

387383
<OnboardingOption optionId="profiling" hideForThisOption>
388384

389-
```jsx
390-
<OnboardingOption optionId="profiling" hideForThisOption>
391-
This code block is wrapped in a `OnboardingOption` component and will only
392-
be rendered when the `profiling` option is NOT selected.
393-
</OnboardingOption>
394-
```
385+
```jsx
386+
<OnboardingOption optionId="profiling" hideForThisOption>
387+
This code block is wrapped in a `OnboardingOption` component and will only
388+
be rendered when the `profiling` option is NOT selected.
389+
</OnboardingOption>
390+
```
391+
395392
</OnboardingOption>

src/components/pageGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Props = {
1313
header?: string;
1414
};
1515

16-
export function PageGrid({header}: Props) {
16+
export function PageGrid({header, exclude}: Props) {
1717
const {rootNode, path} = serverContext();
1818

1919
const parentNode = nodeForPath(rootNode, path);
@@ -27,7 +27,7 @@ export function PageGrid({header}: Props) {
2727
<ul>
2828
{parentNode.children
2929
/* NOTE: temp fix while we figure out the reason why some nodes have empty front matter */
30-
.filter(c => c.frontmatter.title)
30+
.filter(c => c.frontmatter.title && !exclude?.includes(c.slug))
3131
.sort((a, b) => sidebarOrderSorter(a.frontmatter, b.frontmatter))
3232
.map(n => (
3333
<li key={n.path} style={{marginBottom: '1rem'}}>

0 commit comments

Comments
 (0)