Skip to content

Commit 804daf4

Browse files
committed
chore: convert to tailwind
1 parent b236455 commit 804daf4

File tree

1 file changed

+25
-61
lines changed

1 file changed

+25
-61
lines changed
Lines changed: 25 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { type Interpolation, type Theme, useTheme } from "@emotion/react";
1+
import type { Interpolation, Theme } from "@emotion/react";
22
import type { ComponentProps, FC, HTMLAttributes } from "react";
33
import { Link, type LinkProps } from "react-router";
4+
import { cn } from "utils/cn";
45
import { TopbarIconButton } from "./Topbar";
56

67
export const Sidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
@@ -13,8 +14,16 @@ export const Sidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
1314
);
1415
};
1516

16-
export const SidebarLink: FC<LinkProps> = (props) => {
17-
return <Link css={styles.sidebarItem} {...props} />;
17+
export const SidebarLink: FC<LinkProps> = ({ className, ...props }) => {
18+
return (
19+
<Link
20+
className={cn(
21+
"text-[13px] text-content-primary py-2 px-4 text-left bg-transparent hover:divide-surface-tertiary cursor-pointer border-0 no-underline",
22+
className,
23+
)}
24+
{...props}
25+
/>
26+
);
1827
};
1928

2029
interface SidebarItemProps extends HTMLAttributes<HTMLButtonElement> {
@@ -23,21 +32,16 @@ interface SidebarItemProps extends HTMLAttributes<HTMLButtonElement> {
2332

2433
export const SidebarItem: FC<SidebarItemProps> = ({
2534
isActive,
35+
className,
2636
...buttonProps
2737
}) => {
28-
const theme = useTheme();
29-
3038
return (
3139
<button
32-
css={[
33-
styles.sidebarItem,
34-
{ opacity: "0.75", "&:hover": { opacity: 1 } },
35-
isActive && {
36-
background: theme.palette.action.selected,
37-
opacity: 1,
38-
pointerEvents: "none",
39-
},
40-
]}
40+
className={cn(
41+
"text-[13px] text-content-primary py-2 px-4 text-left bg-transparent hover:divide-surface-tertiary opacity-75 hover:opacity-100 cursor-pointer border-0",
42+
isActive && "opacity-100 bg-surface-tertiary",
43+
className,
44+
)}
4145
{...buttonProps}
4246
/>
4347
);
@@ -46,15 +50,7 @@ export const SidebarItem: FC<SidebarItemProps> = ({
4650
export const SidebarCaption: FC<HTMLAttributes<HTMLSpanElement>> = (props) => {
4751
return (
4852
<span
49-
css={{
50-
fontSize: 10,
51-
lineHeight: 1.2,
52-
padding: "12px 16px",
53-
display: "block",
54-
textTransform: "uppercase",
55-
fontWeight: 500,
56-
letterSpacing: "0.1em",
57-
}}
53+
className="text-[10px] leading-tight py-3 px-4 uppercase font-medium text-content-primary tracking-widest"
5854
{...props}
5955
/>
6056
);
@@ -66,49 +62,17 @@ interface SidebarIconButton extends ComponentProps<typeof TopbarIconButton> {
6662

6763
export const SidebarIconButton: FC<SidebarIconButton> = ({
6864
isActive,
65+
className,
6966
...buttonProps
7067
}) => {
7168
return (
7269
<TopbarIconButton
73-
css={[
74-
{ opacity: 0.75, "&:hover": { opacity: 1 } },
75-
isActive && styles.activeSidebarIconButton,
76-
]}
70+
className={cn(
71+
"opacity-75 hover:opacity-100 border-0 border-x-2 border-x-transparent border-solid",
72+
isActive && "opacity-100 relative border-l-sky-400",
73+
className,
74+
)}
7775
{...buttonProps}
7876
/>
7977
);
8078
};
81-
82-
const styles = {
83-
sidebarItem: (theme) => ({
84-
fontSize: 13,
85-
lineHeight: 1.2,
86-
color: theme.palette.text.primary,
87-
textDecoration: "none",
88-
padding: "8px 16px",
89-
display: "block",
90-
textAlign: "left",
91-
background: "none",
92-
border: 0,
93-
cursor: "pointer",
94-
95-
"&:hover": {
96-
backgroundColor: theme.palette.action.hover,
97-
},
98-
}),
99-
100-
activeSidebarIconButton: (theme) => ({
101-
opacity: 1,
102-
position: "relative",
103-
"&::before": {
104-
content: '""',
105-
position: "absolute",
106-
left: 0,
107-
top: 0,
108-
bottom: 0,
109-
width: 2,
110-
backgroundColor: theme.palette.primary.main,
111-
height: "100%",
112-
},
113-
}),
114-
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)