Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3c63c8c

Browse files
committed
fix: fix tabs styling
1 parent 2354883 commit 3c63c8c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
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>

0 commit comments

Comments
 (0)