Skip to content

Commit

Permalink
fix: Re-add IconButton route links
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Feb 18, 2022
1 parent 9a35f1f commit edaf689
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/components/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import {
Button,
ButtonProps,
chakra,
IconButton,
IconButtonProps,
Link as ChakraLink,
LinkProps as ChakraLinkProps,
} from '@chakra-ui/react'
import type { Merge } from '@chakra-ui/utils'
import NextLink, { LinkProps as NextLinkProps } from 'next/link'
import { NextRouter, useRouter } from 'next/router'
import type React from 'react'
Expand Down Expand Up @@ -110,6 +113,28 @@ export const ButtonRouteLink: React.FC<ButtonRouteLinkProps> = ({

// --

export interface IconButtonRouteLinkProps
extends Merge<RouteLinkProps, IconButtonProps> {}

export const IconButtonRouteLink: React.FC<IconButtonRouteLinkProps> = ({
...props
}) => {
return <IconButton as={RouteLink} {...props} />
}

// --

export interface IconButtonOutgoingLinkProps
extends Merge<Omit<OutgoingLinkProps, 'externalIcon'>, IconButtonProps> {}

export const IconButtonOutgoingLink: React.FC<IconButtonOutgoingLinkProps> = ({
...props
}) => {
return <IconButton as={OutgoingLink} {...props} />
}

// --

export interface ShouldBeActiveArgs {
to: string
as: string
Expand Down

0 comments on commit edaf689

Please sign in to comment.