Skip to content

fix(site): fix sidebar styles #10891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion site/src/components/SettingsLayout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const Sidebar: React.FC<{ user: User }> = ({ user }) => {
title={user.username}
subtitle={user.email}
/>
;
<SidebarNavItem href="account" icon={AccountIcon}>
Account
</SidebarNavItem>
Expand Down
45 changes: 45 additions & 0 deletions site/src/components/Sidebar/Sidebar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Sidebar, SidebarHeader, SidebarNavItem } from "./Sidebar";
import type { Meta, StoryObj } from "@storybook/react";
import { UserAvatar } from "components/UserAvatar/UserAvatar";
import VpnKeyOutlined from "@mui/icons-material/VpnKeyOutlined";
import FingerprintOutlinedIcon from "@mui/icons-material/FingerprintOutlined";
import AccountIcon from "@mui/icons-material/Person";
import ScheduleIcon from "@mui/icons-material/EditCalendarOutlined";
import SecurityIcon from "@mui/icons-material/LockOutlined";

const meta: Meta<typeof Sidebar> = {
title: "components/Sidebar",
component: Sidebar,
};

export default meta;
type Story = StoryObj<typeof Sidebar>;

export const Default: Story = {
args: {
children: (
<Sidebar>
<SidebarHeader
avatar={<UserAvatar username="Jon" />}
title="Jon"
subtitle="jon@coder.com"
/>
<SidebarNavItem href="account" icon={AccountIcon}>
Account
</SidebarNavItem>
<SidebarNavItem href="schedule" icon={ScheduleIcon}>
Schedule
</SidebarNavItem>
<SidebarNavItem href="security" icon={SecurityIcon}>
Security
</SidebarNavItem>
<SidebarNavItem href="ssh-keys" icon={FingerprintOutlinedIcon}>
SSH Keys
</SidebarNavItem>
<SidebarNavItem href="tokens" icon={VpnKeyOutlined}>
Tokens
</SidebarNavItem>
</Sidebar>
),
},
};
12 changes: 8 additions & 4 deletions site/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ export const SidebarHeader: FC<SidebarHeaderProps> = ({
return (
<Stack direction="row" alignItems="center" css={styles.info}>
{avatar}
<div css={styles.data}>
<div
css={{
overflow: "hidden",
display: "flex",
flexDirection: "column",
}}
>
{linkTo ? (
<Link css={styles.title} to={linkTo}>
{title}
Expand Down Expand Up @@ -80,9 +86,7 @@ const styles = {
...(theme.typography.body2 as CSSObject),
marginBottom: 16,
}),
data: {
overflow: "hidden",
},

title: (theme) => ({
fontWeight: 600,
overflow: "hidden",
Expand Down