An open source design system that's fully customizable and agent ready
TypeScript
fix(nav): consistent gap and heading text sizes (#616)
Cindy Zhangb871eb131852
diff --git a/packages/core/src/SideNav/XDSSideNavHeading.tsx b/packages/core/src/SideNav/XDSSideNavHeading.tsxindex d469f938d5..23774cf466 100644--- a/packages/core/src/SideNav/XDSSideNavHeading.tsx+++ b/packages/core/src/SideNav/XDSSideNavHeading.tsx@@ -90,7 +90,7 @@ const styles = stylex.create({whiteSpace: 'nowrap',},heading: {- fontSize: textSizeVars['--text-base'],+ fontSize: textSizeVars['--text-lg'],fontWeight: fontWeightVars['--font-weight-semibold'],lineHeight: lineHeightVars['--leading-snug'],color: colorVars['--color-text-primary'],@@ -99,6 +99,10 @@ const styles = stylex.create({textOverflow: 'ellipsis',whiteSpace: 'nowrap',},+ // When super/sub headings are present, scale down the app name+ headingCompact: {+ fontSize: textSizeVars['--text-base'],+ },subheading: {fontSize: textSizeVars['--text-xsm'],lineHeight: lineHeightVars['--leading-snug'],@@ -260,6 +264,7 @@ export function XDSSideNavHeading({const showChevron = !!menu;const hasAnyHref = !!(headingHref || superheadingHref || subheadingHref);+ const hasCompactHeading = !!(superheading || subheading);// Determine interaction modeconst isWholeHeadingTrigger = !!menu && !hasAnyHref;@@ -312,7 +317,13 @@ export function XDSSideNavHeading({{heading}</XDSLink>) : (- <span {...stylex.props(styles.heading)}>{heading}</span>+ <span+ {...stylex.props(+ styles.heading,+ hasCompactHeading && styles.headingCompact,+ )}>+ {heading}+ </span>)}{subheading &&(hasAnyHref && subheadingHref && menu ? (@@ -468,7 +479,13 @@ export function XDSSideNavHeading({{heading}</XDSLink>) : (- <span {...stylex.props(styles.heading)}>{heading}</span>+ <span+ {...stylex.props(+ styles.heading,+ hasCompactHeading && styles.headingCompact,+ )}>+ {heading}+ </span>)}{subheading &&(subheadingHref ? (diff --git a/packages/core/src/TopNav/XDSTopNav.tsx b/packages/core/src/TopNav/XDSTopNav.tsxindex 25517db289..ad05707b06 100644--- a/packages/core/src/TopNav/XDSTopNav.tsx+++ b/packages/core/src/TopNav/XDSTopNav.tsx@@ -71,12 +71,12 @@ const styles = stylex.create({display: 'flex',alignItems: 'center',justifyContent: 'flex-end',- gap: spacingVars['--spacing-2'],+ gap: spacingVars['--spacing-1'],},endContent: {display: 'flex',alignItems: 'center',- gap: spacingVars['--spacing-2'],+ gap: spacingVars['--spacing-1'],flexShrink: 0,marginInlineStart: 'auto',},