Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
indaviande committed Dec 9, 2024
1 parent cbbd1be commit 7386f78
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions src/components/primitives/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Link, useLocation } from "@remix-run/react";

import type { ReactNode } from "react";
import { type VariantProps, tv } from "tailwind-variants";
import { Container } from "../..";
import useThemableProps from "../../hooks/theming/useThemableProps";
import { mergeClass } from "../../utils/css";
import type { Component, Styled, Themable } from "../../utils/types";
import Group from "../extenders/Group";
import EventBlocker from "./EventBlocker";
import { Container } from "../..";

export const tabsStyles = tv(
{
Expand Down Expand Up @@ -79,7 +79,7 @@ export const tabsStyles = tv(
size: "md",
},
},
{ twMerge: false }
{ twMerge: false },
);

type TabsStyleProps = VariantProps<typeof tabsStyles>;
Expand All @@ -99,15 +99,7 @@ export type TabsProps = Component<
HTMLButtonElement
>;

export default function Tabs({
look,
size,
to,
theme,
className,
tabs = [],
...props
}: TabsProps) {
export default function Tabs({ look, size, to, theme, className, tabs = [], ...props }: TabsProps) {
const themeVars = useThemableProps(props);
const styleProps = tabsStyles({ look, size });
const location = useLocation();
Expand All @@ -121,37 +113,25 @@ export default function Tabs({
<Group className={mergeClass(container(), "w-full")}>
<Container>
<Group className={mergeClass(line(), "gap-xl*2 items-center w-full")}>
{tabs.map((tab) => {
{tabs.map(tab => {
return (
<>
{tab.link ? (
<EventBlocker key={tab.key}>
<Link
to={tab.link}
style={themeVars}
className={mergeClass(
styleProps,
base(),
className,
location.pathname === tab.link && active()
)}
>
className={mergeClass(styleProps, base(), className, location.pathname === tab.link && active())}>
{tab.label}
</Link>
</EventBlocker>
) : (
<button
key={tab.key}
style={themeVars}
className={mergeClass(
styleProps,
base(),
className,
location.pathname === tab.link && active()
)}
className={mergeClass(styleProps, base(), className, location.pathname === tab.link && active())}
type="button"
{...props}
>
{...props}>
{tab.label}
</button>
)}
Expand Down

0 comments on commit 7386f78

Please sign in to comment.