Remove fishy unused href property from tabs

This commit is contained in:
Marshall Polaris 2022-07-24 14:11:05 -07:00
parent 43cb7114e3
commit 9093b70122

View File

@ -9,8 +9,6 @@ type Tab = {
title: string title: string
tabIcon?: ReactNode tabIcon?: ReactNode
content: ReactNode content: ReactNode
// If set, change the url to this href when the tab is selected
href?: string
// If set, show a badge with this content // If set, show a badge with this content
badge?: string badge?: string
} }
@ -33,25 +31,21 @@ export function UncontrolledTabs(props: TabProps & { activeIndex: number }) {
currentPageForAnalytics, currentPageForAnalytics,
} = props } = props
const activeTab = tabs[activeIndex] as Tab | undefined // can be undefined in weird case const activeTab = tabs[activeIndex] as Tab | undefined // can be undefined in weird case
return ( return (
<> <>
<div className={clsx('mb-4 border-b border-gray-200', className)}> <div className={clsx('mb-4 border-b border-gray-200', className)}>
<nav className="-mb-px flex space-x-8" aria-label="Tabs"> <nav className="-mb-px flex space-x-8" aria-label="Tabs">
{tabs.map((tab, i) => ( {tabs.map((tab, i) => (
<Link href={tab.href ?? '#'} key={tab.title} shallow={!!tab.href}> <Link href="#" key={tab.title} shallow={false}>
<a <a
id={`tab-${i}`} id={`tab-${i}`}
key={tab.title} key={tab.title}
onClick={(e) => { onClick={(e) => {
e.preventDefault()
track('Clicked Tab', { track('Clicked Tab', {
title: tab.title, title: tab.title,
href: tab.href,
currentPage: currentPageForAnalytics, currentPage: currentPageForAnalytics,
}) })
if (!tab.href) {
e.preventDefault()
}
onClick?.(tab.title, i) onClick?.(tab.title, i)
}} }}
className={clsx( className={clsx(