Skip to content

Commit 54d4b7b

Browse files
committed
update PropTable and StateTable from main
1 parent 661fd70 commit 54d4b7b

File tree

2 files changed

+33
-27
lines changed

2 files changed

+33
-27
lines changed

packages/dev/s2-docs/src/PropTable.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {Code, styles as codeStyles} from './Code';
2+
import {CSSVariables, StateTable} from './StateTable';
23
import {DisclosureRow} from './DisclosureRow';
34
import React from 'react';
45
import {renderHTMLfromMarkdown, setLinks, TComponent, TInterface, TType, Type} from './types';
5-
import {StateTable} from './StateTable';
66
import {style} from '@react-spectrum/s2/style' with {type: 'macro'};
77
import {Table, TableBody, TableCell, TableColumn, TableHeader, TableRow} from './Table';
88

@@ -104,9 +104,9 @@ export function PropTable({component, links, showDescription, hideRenderProps, s
104104
style={!defaultClassName ? {marginTop: 16} : undefined}
105105
properties={renderProps.properties}
106106
showOptional={showOptionalRenderProps}
107-
hideSelector={hideSelector}
108-
cssVariables={cssVariables} />
109-
) : null}
107+
hideSelector={hideSelector} />
108+
) : null}
109+
{cssVariables && <CSSVariables cssVariables={cssVariables} />}
110110
</>
111111
);
112112
}

packages/dev/s2-docs/src/StateTable.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,38 @@ export function StateTable({properties, links, showOptional, hideSelector, cssVa
6161
table = (
6262
<>
6363
{table}
64-
<Table style={{marginTop: 16}}>
65-
<TableHeader>
66-
<TableRow>
67-
<TableColumn role="columnheader">CSS Variable</TableColumn>
68-
</TableRow>
69-
</TableHeader>
70-
<TableBody>
71-
{Object.entries(cssVariables).map(([name, description]) => (
72-
<Fragment key={name}>
73-
<TableRow>
74-
<TableCell role="rowheader" hideBorder>
75-
<code className={codeStyle}>
76-
<span className={codeStyles.property}>{name}</span>
77-
</code>
78-
</TableCell>
79-
</TableRow>
80-
<TableRow>
81-
<TableCell>{renderHTMLfromMarkdown(description, {forceInline: true})}</TableCell>
82-
</TableRow>
83-
</Fragment>
84-
))}
85-
</TableBody>
86-
</Table>
64+
<CSSVariables cssVariables={cssVariables} />
8765
</>
8866
);
8967
}
9068

9169
return table;
9270
}
71+
72+
export function CSSVariables({cssVariables}: {cssVariables: {[name: string]: string}}) {
73+
return (
74+
<Table style={{marginTop: 16}}>
75+
<TableHeader>
76+
<TableRow>
77+
<TableColumn role="columnheader">CSS Variable</TableColumn>
78+
</TableRow>
79+
</TableHeader>
80+
<TableBody>
81+
{Object.entries(cssVariables).map(([name, description]) => (
82+
<Fragment key={name}>
83+
<TableRow>
84+
<TableCell role="rowheader" hideBorder>
85+
<code className={codeStyle}>
86+
<span className={codeStyles.property}>{name}</span>
87+
</code>
88+
</TableCell>
89+
</TableRow>
90+
<TableRow>
91+
<TableCell>{renderHTMLfromMarkdown(description, {forceInline: true})}</TableCell>
92+
</TableRow>
93+
</Fragment>
94+
))}
95+
</TableBody>
96+
</Table>
97+
);
98+
}

0 commit comments

Comments
 (0)