Skip to content

Commit 69c5d55

Browse files
Rename DocumentationContent's content prop to blocks
'content' is a Panda utility name (the CSS property), and Panda extracts utility-named props from any capitalised JSX component (playbook gotcha #17) - the unresolvable PortableText values emitted two broken empty rules, the long-standing 'sheet:process' errors in every codegen run. 'blocks' matches the BlockContent API it feeds. panda cssgen now runs error-free.
1 parent 49af1cd commit 69c5d55

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/documentation/common/DocumentationContent.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe("DocumentationContent", () => {
3939
style: "normal",
4040
},
4141
];
42-
const view = render(<DocumentationContent content={content} />);
42+
const view = render(<DocumentationContent blocks={content} />);
4343
expect(view.container.innerHTML).toMatchInlineSnapshot(
4444
`"<div class="d_flex flex-d_column gap_3 mt_3"><p><a href="https://www.bbc.co.uk/bitesize/guides/zscvxfr/revision/4" target="_blank" rel="nofollow noopener" class="cursor_pointer td_none ring_none trs-prop_background-color,_border-color,_color,_fill,_stroke,_opacity,_box-shadow,_transform trs-dur_normal hover:td_underline focusVisible:focus-shadow_outline c_brand.600">Read more about ASCII<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" class="w_1em h_1em d_inline-block lh_1em flex-sh_0 fill_currentColor mb_0.333em ml_1 va_middle" focusable="false" aria-hidden="true" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"></path></svg></a>.</p></div>"`
4545
);
@@ -56,7 +56,7 @@ describe("DocumentationContent", () => {
5656
},
5757
},
5858
];
59-
const view = render(<DocumentationContent content={content} />);
59+
const view = render(<DocumentationContent blocks={content} />);
6060
expect(view.container.innerHTML).toMatchInlineSnapshot(
6161
`"<div class="d_flex flex-d_column gap_3 mt_3"><img src="https://cdn.sanity.io/images/project/dataset/9fccaf51a164fedc98662188593de19bfb9be8ad-435x512.png?w=300&amp;q=80&amp;fit=max&amp;auto=format" alt="micro:bit showing X axis going across the front, Y axis going down and up, Z axis going back to front" class="max-w_100% w_300px bdr_lg bd_solid_1px bd-c_gray.300"></div>"`
6262
);

src/documentation/common/DocumentationContent.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const enum DocumentationCollapseMode {
3030
}
3131

3232
interface DocumentationContentProps {
33-
content?: PortableText;
33+
blocks?: PortableText;
3434
details?: DocumentationCollapseMode;
3535
}
3636

@@ -231,18 +231,18 @@ const serializers = {
231231
* Wrap with DocumentationContextProvider for linking and other contextual behaviours.
232232
*/
233233
const DocumentationContent = ({
234-
content,
234+
blocks,
235235
details = DocumentationCollapseMode.ShowAll,
236236
}: DocumentationContentProps) => {
237237
// If we're expanding or collapsing then we pre-process the content to wrap every run of non-code in Collapse.
238-
content = useMemo(() => {
238+
blocks = useMemo(() => {
239239
if (details === DocumentationCollapseMode.ShowAll) {
240-
return content || [];
240+
return blocks || [];
241241
}
242-
return decorateWithCollapseNodes(content, details);
243-
}, [details, content]);
242+
return decorateWithCollapseNodes(blocks, details);
243+
}, [details, blocks]);
244244

245-
const rendered = <BlockContent blocks={content} serializers={serializers} />;
245+
const rendered = <BlockContent blocks={blocks} serializers={serializers} />;
246246
return details === DocumentationCollapseMode.ShowAll ? (
247247
<Stack gap="3" mt="3">
248248
{rendered}

src/documentation/ideas/IdeasDocumentation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const ActiveLevel = ({
121121
toolkitType="ideas"
122122
title={activeIdea.name}
123123
>
124-
<DocumentationContent content={activeIdea.content} />
124+
<DocumentationContent blocks={activeIdea.content} />
125125
</DocumentationContextProvider>
126126
</Stack>
127127
)}

src/documentation/reference/ReferenceDocumentation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const ActiveLevel = ({
9090
>
9191
{topic.introduction && (
9292
<Box p="5" pb="1" fontSize="sm" className={docStylesClass}>
93-
<DocumentationContent content={topic.introduction} />
93+
<DocumentationContent blocks={topic.introduction} />
9494
</Box>
9595
)}
9696
<List flex="1 1 auto">

src/documentation/reference/ReferenceTopicEntry.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ const ReferenceTopicEntry = ({
123123
</HStack>
124124

125125
<DocumentationContent
126-
content={content}
126+
blocks={content}
127127
details={
128128
hasMore
129129
? DocumentationCollapseMode.ExpandCollapseExceptCodeAndFirstLine
@@ -154,13 +154,13 @@ const ReferenceTopicEntry = ({
154154

155155
<DocumentationContent
156156
details={DocumentationCollapseMode.ExpandCollapseExceptCode}
157-
content={activeAlterativeContent}
157+
blocks={activeAlterativeContent}
158158
/>
159159
</>
160160
)}
161161
<DocumentationContent
162162
details={DocumentationCollapseMode.ExpandCollapseAll}
163-
content={detailContent}
163+
blocks={detailContent}
164164
/>
165165
</Box>
166166
</Highlight>

0 commit comments

Comments
 (0)