({anchorId, isHovered, level, headingText})
| 31 | } |
| 32 | |
| 33 | function AnchorLink({anchorId, isHovered, level, headingText}) { |
| 34 | let {isFocusVisible, focusProps} = useFocusRing({within: true}); |
| 35 | const href = `#${anchorId}`; |
| 36 | return ( |
| 37 | <span |
| 38 | {...focusProps} |
| 39 | className={style({ |
| 40 | position: 'absolute', |
| 41 | opacity: { |
| 42 | default: 0, |
| 43 | isHovered: 1, |
| 44 | isFocusVisible: 1 |
| 45 | }, |
| 46 | marginStart: { |
| 47 | default: 8, |
| 48 | level: { |
| 49 | 3: 4, |
| 50 | 4: 4 |
| 51 | } |
| 52 | }, |
| 53 | transition: '[opacity 0.2s ease-in-out]' |
| 54 | })({isHovered, isFocusVisible, level})}> |
| 55 | <Link href={href} aria-label={`Link to ${headingText}`}> |
| 56 | <LinkIcon |
| 57 | styles={iconStyle({size: 'S', marginBottom: 4})} |
| 58 | UNSAFE_style={{marginBottom: level === 3 || level === 4 ? 0 : undefined}} |
| 59 | /> |
| 60 | </Link> |
| 61 | </span> |
| 62 | ); |
| 63 | } |
| 64 | |
| 65 | const h1 = style({ |
| 66 | font: 'heading-3xl', |
nothing calls this directly
no test coverage detected