@@ -19,12 +19,12 @@ module.exports = function (context, options) {
19
19
try {
20
20
let COMPONENT_LINK_REGEXP ;
21
21
const response = await fetch ( `https://unpkg.com/@ionic/docs@${ npmTag } /core.json` ) ;
22
-
22
+
23
23
if ( ! response . ok ) {
24
24
console . error ( `Failed to fetch component data for ${ npmTag } : ${ response . status } ` ) ;
25
25
return ;
26
26
}
27
-
27
+
28
28
const { components } = await response . json ( ) ;
29
29
30
30
const names = components . map ( ( component ) => component . tag . slice ( 4 ) ) ;
@@ -54,7 +54,6 @@ module.exports = function (context, options) {
54
54
55
55
for ( const version of options . versions ) {
56
56
const npmTag = version . slice ( 1 ) ;
57
-
58
57
await generateMarkdownForVersion ( version , npmTag , false ) ;
59
58
}
60
59
@@ -242,4 +241,61 @@ function renderCustomProps({ styles: customProps }) {
242
241
const mdProps = customProps . filter ( ( prop ) => prop . mode === 'md' ) ;
243
242
244
243
const renderTable = ( props ) => {
245
- if
244
+ if ( props . length === 0 ) {
245
+ return 'No CSS custom properties available for this component.' ;
246
+ }
247
+
248
+ return `
249
+ | Name | Description |
250
+ | --- | --- |
251
+ ${ props . map ( ( prop ) => `| \`${ prop . name } \` | ${ formatMultiline ( prop . docs ) } |` ) . join ( '\n' ) }
252
+ ` ;
253
+ } ;
254
+
255
+ if ( iosProps . length > 0 || mdProps . length > 0 ) {
256
+ // If the component has mode-specific custom props, render them in tabs for iOS and MD
257
+ return `
258
+ import Tabs from '@theme/Tabs';
259
+ import TabItem from '@theme/TabItem';
260
+
261
+ \`\`\`\`mdx-code-block
262
+ <Tabs
263
+ groupId="mode"
264
+ defaultValue="ios"
265
+ values={[
266
+ { value: 'ios', label: 'iOS' },
267
+ { value: 'md', label: 'MD' },
268
+ ]
269
+ }>
270
+ <TabItem value="ios">
271
+
272
+ ${ renderTable ( iosProps ) }
273
+
274
+ </TabItem>
275
+
276
+ <TabItem value="md">
277
+
278
+ ${ renderTable ( mdProps ) }
279
+
280
+ </TabItem>
281
+ </Tabs>
282
+ \`\`\`\`
283
+
284
+ ` ;
285
+ }
286
+ // Otherwise render the custom props without the tabs for iOS and MD
287
+ return renderTable ( customProps ) ;
288
+ }
289
+
290
+ function renderSlots ( { slots } ) {
291
+ if ( slots . length === 0 ) {
292
+ return 'No slots available for this component.' ;
293
+ }
294
+
295
+ return `
296
+ | Name | Description |
297
+ | --- | --- |
298
+ ${ slots . map ( ( slot ) => `| \`${ slot . name } \` | ${ formatMultiline ( slot . docs ) } |` ) . join ( '\n' ) }
299
+
300
+ ` ;
301
+ }
0 commit comments