Skip to content

Commit a64ae6f

Browse files
committed
dont render value description title twice if it is the only value
1 parent 87d2059 commit a64ae6f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -919,13 +919,19 @@ export function StyleMacroProperties({properties}: StyleMacroPropertiesProps) {
919919
{propDef.additionalTypes && propDef.additionalTypes.map((typeName, i) => {
920920
let typeLink = styleMacroValueDesc[typeName];
921921
if (typeLink?.description || typeLink?.body) {
922+
// dont render the type name for properties that only have one special value (e.g. baseSpacing) that has an associated description
923+
// so that we don't double up on rendering the value name
924+
let shouldSkipTypeName = values.length === 0 && propDef.additionalTypes?.length === 1;
925+
922926
return (
923927
<div key={`type-desc-${i}`}>
924-
<h4 className={style({font: 'ui', fontWeight: 'bold', marginBottom: 8})}>
925-
<code className={codeStyle}>
926-
<span className={codeStyles.variable}>{typeName}</span>
927-
</code>
928-
</h4>
928+
{!shouldSkipTypeName && (
929+
<h4 className={style({font: 'ui', fontWeight: 'bold', marginBottom: 8})}>
930+
<code className={codeStyle}>
931+
<span className={codeStyles.variable}>{typeName}</span>
932+
</code>
933+
</h4>
934+
)}
929935
{typeLink.description && (
930936
<p className={style({font: 'body', marginBottom: 8})}>
931937
{typeLink.description}

0 commit comments

Comments
 (0)