(props: SideNavItemLinkProps)
| 680 | } |
| 681 | |
| 682 | export const SideNavItemLink = (props: SideNavItemLinkProps): ReactNode => { |
| 683 | let {children} = props; |
| 684 | let {selectedRoute} = useContext(InternalSideNavContext); |
| 685 | let linkProps = useContext(SideNavItemLinkContext); |
| 686 | |
| 687 | return ( |
| 688 | <Link |
| 689 | {...props} |
| 690 | {...linkProps} |
| 691 | aria-current={selectedRoute === linkProps.href ? 'page' : undefined} |
| 692 | className={treeRowLink({isDisabled: linkProps.isDisabled})}> |
| 693 | <Provider |
| 694 | values={[ |
| 695 | [TextContext, {styles: treeContent}], |
| 696 | [ |
| 697 | IconContext, |
| 698 | { |
| 699 | render: centerBaseline({slot: 'icon', styles: treeIcon}), |
| 700 | styles: style({size: fontRelative(20), flexShrink: 0}) |
| 701 | } |
| 702 | ] |
| 703 | ]}> |
| 704 | {typeof children === 'string' ? <Text>{children}</Text> : children} |
| 705 | </Provider> |
| 706 | </Link> |
| 707 | ); |
| 708 | }; |
| 709 | |
| 710 | // The collection key of the item whose href matches `route`, or null. getKeys() covers collapsed |
| 711 | // items too, and the href is stored as a data attribute so it doesn't trigger Tree's link handling. |
nothing calls this directly
no test coverage detected