react#AriaAttributes TypeScript Examples

The following examples show how to use react#AriaAttributes. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NavigationList.tsx    From crowdsource-dataplatform with MIT License 6 votes vote down vote up
useNavLink = () => {
  const { asPath: currentRoutePath } = useRouter();
  const getNavLinkProps = useCallback(
    routePath => {
      if (currentRoutePath === routePath || currentRoutePath.includes(routePath)) {
        return {
          className: classnames(
            `${styles.link} ${styles.activeLink} font-family-rowdies d-flex align-items-center display-5 p-4 px-xl-5 py-xl-0`
          ),
          'aria-current': 'page' as AriaAttributes['aria-current'],
        };
      } else {
        return {
          className: classnames(
            `${styles.link} font-family-rowdies d-flex align-items-center display-5 p-4 px-xl-5 py-xl-0`
          ),
          'aria-current': undefined as AriaAttributes['aria-current'],
        };
      }
    },
    [currentRoutePath]
  );
  return {
    getNavLinkProps,
  };
}