import { Link } from '@tutorbook/intl'; import React from 'react'; import styles from './tabs.module.scss'; interface TabProps { label: string; active?: boolean; } interface TabButtonProps extends TabProps { onClick: () => void; } function TabButton({ label, onClick, active }: TabButtonProps): JSX.Element { const className = styles.tab + (active ? ` ${styles.active}` : ''); return ( ); } interface TabLinkProps extends TabProps { href: string; } function TabLink({ label, href, active }: TabLinkProps): JSX.Element { const className = styles.tab + (active ? ` ${styles.active}` : ''); if (href.indexOf('http') < 0) return ( /* eslint-disable jsx-a11y/anchor-is-valid */ {label} /* eslint-enable jsx-a11y/anchor-is-valid */ ); return ( {label} ); } export interface TabsProps { tabs: (TabLinkProps | TabButtonProps)[]; } function isTabLinkProps( tab: TabLinkProps | TabButtonProps ): tab is TabLinkProps { return (tab as TabLinkProps).href !== undefined; } export default function Tabs({ tabs }: TabsProps): JSX.Element { return (