| 65 | } |
| 66 | |
| 67 | export const getLinkStyles = (theme?: Theme, ariaCurrent?: string | boolean) => ({ |
| 68 | position: 'relative', |
| 69 | display: 'inline-flex', |
| 70 | color: 'fg.default', |
| 71 | textAlign: 'center', |
| 72 | textDecoration: 'none', |
| 73 | lineHeight: 'calc(20/14)', |
| 74 | '& span[data-component="icon"]': { |
| 75 | color: 'fg.muted', |
| 76 | }, |
| 77 | borderRadius: 2, |
| 78 | fontSize: 1, |
| 79 | paddingX: 2, |
| 80 | paddingY: 'calc((2rem - 1.25rem) / 2)', |
| 81 | '@media (hover:hover)': { |
| 82 | '&:hover ': { |
| 83 | backgroundColor: theme?.colors.neutral.muted, |
| 84 | transition: 'background .12s ease-out', |
| 85 | textDecoration: 'none', |
| 86 | }, |
| 87 | }, |
| 88 | '&:focus': { |
| 89 | outline: '2px solid transparent', |
| 90 | '&': { |
| 91 | boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`, |
| 92 | }, |
| 93 | // where focus-visible is supported, remove the focus box-shadow |
| 94 | '&:not(:focus-visible)': { |
| 95 | boxShadow: 'none', |
| 96 | }, |
| 97 | }, |
| 98 | '&:focus-visible': { |
| 99 | outline: '2px solid transparent', |
| 100 | boxShadow: `inset 0 0 0 2px ${theme?.colors.accent.fg}`, |
| 101 | }, |
| 102 | // renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected |
| 103 | '& span[data-content]::before': { |
| 104 | content: 'attr(data-content)', |
| 105 | display: 'block', |
| 106 | height: 0, |
| 107 | fontWeight: '600', |
| 108 | visibility: 'hidden', |
| 109 | whiteSpace: 'nowrap', |
| 110 | }, |
| 111 | // selected state styles |
| 112 | '&::after': { |
| 113 | position: 'absolute', |
| 114 | right: '50%', |
| 115 | bottom: 'calc(50% - 25px)', // 48px total height / 2 (24px) + 1px |
| 116 | width: '100%', |
| 117 | height: 2, |
| 118 | content: '""', |
| 119 | backgroundColor: |
| 120 | Boolean(ariaCurrent) && ariaCurrent !== 'false' ? theme?.colors.primer.border.active : 'transparent', |
| 121 | borderRadius: 0, |
| 122 | transform: 'translate(50%, -50%)', |
| 123 | }, |
| 124 | '@media (forced-colors: active)': { |