@@ -2,6 +2,13 @@ import {Theme} from '../ThemeProvider'
22import { BetterSystemStyleObject } from '../sx'
33import { UnderlineNavProps } from './UnderlineNav'
44
5+ // The gap between the list items. It is a constant because the gap is used to calculate the possible number of items that can fit in the container.
6+ export const GAP = 8
7+
8+ const focusRing = ( theme ?: Theme ) : BetterSystemStyleObject => ( {
9+ boxShadow : `inset 0 0 0 2px ${ theme ?. colors . accent . fg } `
10+ } )
11+
512export const iconWrapStyles = {
613 alignItems : 'center' ,
714 display : 'inline-flex' ,
@@ -48,7 +55,8 @@ export const ulStyles = {
4855 paddingX : 0 ,
4956 margin : '0' ,
5057 marginBottom : '-1px' ,
51- alignItems : 'center'
58+ alignItems : 'center' ,
59+ gap : `${ GAP } px`
5260}
5361
5462export const getDividerStyle = ( theme ?: Theme ) => ( {
@@ -106,15 +114,14 @@ export const getArrowBtnStyles = (theme?: Theme) => ({
106114 // To reset global focus styles because it doesn't support safari right now.
107115 '&:focus:not(:disabled)' : {
108116 outline : 0 ,
109- boxShadow : `inset 0 0 0 2px ${ theme ?. colors . accent . fg } `
117+ ... focusRing ( theme )
110118 } ,
111119 // where focus-visible is supported, remove the focus box-shadow
112120 '&:not(:focus-visible)' : {
113121 boxShadow : 'none'
114122 } ,
115123 '&:focus-visible:not(:disabled)' : {
116- outline : 0 ,
117- boxShadow : `inset 0 0 0 2px ${ theme ?. colors . accent . fg } `
124+ ...focusRing ( theme )
118125 }
119126} )
120127
@@ -129,7 +136,6 @@ export const getLinkStyles = (
129136 color : 'fg.default' ,
130137 textAlign : 'center' ,
131138 textDecoration : 'none' ,
132- paddingX : 1 ,
133139 ...( props ?. variant === 'small' ? smallVariantLinkStyles : defaultVariantLinkStyles ) ,
134140 '@media (hover:hover)' : {
135141 '&:hover > div[data-component="wrapper"] ' : {
@@ -140,15 +146,15 @@ export const getLinkStyles = (
140146 '&:focus' : {
141147 outline : 0 ,
142148 '& > div[data-component="wrapper"]' : {
143- boxShadow : `inset 0 0 0 2px ${ theme ?. colors . accent . fg } `
149+ ... focusRing ( theme )
144150 } ,
145151 // where focus-visible is supported, remove the focus box-shadow
146152 '&:not(:focus-visible) > div[data-component="wrapper"]' : {
147153 boxShadow : 'none'
148154 }
149155 } ,
150156 '&:focus-visible > div[data-component="wrapper"]' : {
151- boxShadow : `inset 0 0 0 2px ${ theme ?. colors . accent . fg } `
157+ ... focusRing ( theme )
152158 } ,
153159 // renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
154160 '& span[data-content]::before' : {
@@ -164,7 +170,7 @@ export const getLinkStyles = (
164170 position : 'absolute' ,
165171 right : '50%' ,
166172 bottom : 0 ,
167- width : `calc( 100% - 8px)` ,
173+ width : ' 100%' ,
168174 height : 2 ,
169175 content : '""' ,
170176 bg : selectedLink === ref ? theme ?. colors . primer . border . active : 'transparent' ,
0 commit comments