Skip to content

Commit aebde7c

Browse files
committed
fix: fix tabs styling
1 parent 1d5c720 commit aebde7c

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

site/src/components/Tabs/Tabs.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type FC, type HTMLAttributes, createContext, useContext } from "react";
22
import { Link, type LinkProps } from "react-router-dom";
33
import { cn } from "utils/cn";
44

5-
export const TAB_PADDING_Y = 12;
5+
// Keeping this for now because of a workaround in WorkspaceBUildPageView
66
export const TAB_PADDING_X = 16;
77

88
type TabsContextValue = {
@@ -13,11 +13,13 @@ const TabsContext = createContext<TabsContextValue | undefined>(undefined);
1313

1414
type TabsProps = HTMLAttributes<HTMLDivElement> & TabsContextValue;
1515

16-
export const Tabs: FC<TabsProps> = ({ active, ...htmlProps }) => {
16+
export const Tabs: FC<TabsProps> = ({ className, active, ...htmlProps }) => {
1717
return (
1818
<TabsContext.Provider value={{ active }}>
1919
<div
20-
className="border-b border-solid border-border border-t-0 border-l-0 border-r-0"
20+
// Because the Tailwind preflight is not used, its necessary to set border style to solid and
21+
// reset all border widths to 0 https://tailwindcss.com/docs/border-width#using-without-preflight
22+
className={cn("border-0 border-b border-solid border-border", className)}
2123
{...htmlProps}
2224
/>
2325
</TabsContext.Provider>

site/src/pages/TemplatePage/TemplateLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { AuthorizationRequest } from "api/typesGenerated";
33
import { ErrorAlert } from "components/Alert/ErrorAlert";
44
import { Loader } from "components/Loader/Loader";
55
import { Margins } from "components/Margins/Margins";
6-
import { TAB_PADDING_Y, TabLink, Tabs, TabsList } from "components/Tabs/Tabs";
6+
import { TabLink, Tabs, TabsList } from "components/Tabs/Tabs";
77
import {
88
type FC,
99
type PropsWithChildren,
@@ -110,7 +110,7 @@ export const TemplateLayout: FC<PropsWithChildren> = ({
110110

111111
<Tabs
112112
active={activeTab}
113-
css={{ marginBottom: 40, marginTop: -TAB_PADDING_Y }}
113+
className="mb-10 -mt-3"
114114
>
115115
<Margins>
116116
<TabsList>

site/src/pages/UsersPage/UsersLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Button from "@mui/material/Button";
44
import { Loader } from "components/Loader/Loader";
55
import { Margins } from "components/Margins/Margins";
66
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
7-
import { TAB_PADDING_Y, TabLink, Tabs, TabsList } from "components/Tabs/Tabs";
7+
import { TabLink, Tabs, TabsList } from "components/Tabs/Tabs";
88
import { useAuthenticated } from "contexts/auth/RequireAuth";
99
import { useDashboard } from "modules/dashboard/useDashboard";
1010
import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility";
@@ -59,7 +59,7 @@ export const UsersLayout: FC = () => {
5959

6060
{!showOrganizations && (
6161
<Tabs
62-
css={{ marginBottom: 40, marginTop: -TAB_PADDING_Y }}
62+
className="mb-10 -mt-3"
6363
active={activeTab}
6464
>
6565
<Margins>

0 commit comments

Comments
 (0)