Skip to content

Commit

Permalink
style: Simplify editor sidebar tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ianjon3s committed Aug 29, 2024
1 parent f484485 commit 3ad6707
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,23 @@ import Tab, { tabClasses, TabProps } from "@mui/material/Tab";
import React from "react";
import { FONT_WEIGHT_SEMI_BOLD } from "theme";

interface StyledTabProps extends TabProps {
tabTheme?: "light" | "dark";
}

const StyledTab = styled(({ tabTheme, ...props }: StyledTabProps) => (
const StyledTab = styled((props: TabProps) => (
<Tab {...props} disableFocusRipple disableTouchRipple disableRipple />
))<StyledTabProps>(({ theme, tabTheme }) => ({
))<TabProps>(({ theme }) => ({
position: "relative",
zIndex: 1,
textTransform: "none",
background: "transparent",
border: `1px solid transparent`,
borderBottomColor: theme.palette.border.main,
color: theme.palette.primary.main,
fontWeight: FONT_WEIGHT_SEMI_BOLD,
color: theme.palette.text.primary,
minWidth: "75px",
minHeight: "36px",
margin: theme.spacing(0, 0.5),
marginBottom: "-1px",
padding: "0.5em",
padding: "0.75em 0.25em",
[`&.${tabClasses.selected}`]: {
background:
tabTheme === "dark"
? theme.palette.background.dark
: theme.palette.background.default,
borderColor: theme.palette.border.main,
borderBottomColor: theme.palette.common.white,
color:
tabTheme === "dark"
? theme.palette.common.white
: theme.palette.text.primary,
fontWeight: FONT_WEIGHT_SEMI_BOLD,
color: theme.palette.text.primary,
boxShadow: `inset 0 -3px 0 ${theme.palette.background.dark}`,
},
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const SidebarContainer = styled(Box)(() => ({
}));

const Header = styled("header")(({ theme }) => ({
padding: theme.spacing(1),
padding: theme.spacing(1, 1.5),
"& input": {
flex: "1",
padding: "5px",
Expand Down Expand Up @@ -108,6 +108,7 @@ const TabList = styled(Box)(({ theme }) => ({
},
"& .MuiTabs-root": {
minHeight: "0",
padding: theme.spacing(0, 1.5),
},
// Hide default MUI indicator as we're using custom styling
"& .MuiTabs-indicator": {
Expand Down Expand Up @@ -389,13 +390,13 @@ const Sidebar: React.FC<{
</Box>
</Header>
<TabList>
<Tabs centered onChange={handleChange} value={activeTab} aria-label="">
<StyledTab value="PreviewBrowser" label="Preview" tabTheme="light" />
<StyledTab value="History" label="History" tabTheme="light" />
<Tabs onChange={handleChange} value={activeTab} aria-label="">
<StyledTab value="PreviewBrowser" label="Preview" />
<StyledTab value="History" label="History" />
{hasFeatureFlag("SEARCH") && (
<StyledTab value="Search" label="Search" tabTheme="light" />
<StyledTab value="Search" label="Search" />
)}
<StyledTab value="Console" label="Console" tabTheme="dark" />
<StyledTab value="Console" label="Console" />
</Tabs>
</TabList>
{activeTab === "PreviewBrowser" && (
Expand Down

0 comments on commit 3ad6707

Please sign in to comment.