Skip to content

Commit c0a872e

Browse files
authored
Polish sidebar channel navigation (#1213)
1 parent 89aaa26 commit c0a872e

5 files changed

Lines changed: 34 additions & 24 deletions

File tree

‎desktop/src/features/channels/ui/MembersSidebar.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,9 @@ function SearchResultSectionTitle({
704704
children: React.ReactNode;
705705
}) {
706706
return (
707-
<div className="sticky top-0 z-10 mr-3 flex min-h-9 items-center gap-2 bg-background/95 px-4 pb-1.5 pt-3 text-xs font-medium uppercase tracking-wide text-muted-foreground/75 backdrop-blur supports-[backdrop-filter]:bg-background/80">
707+
<div className="sticky top-0 z-10 mr-3 flex min-h-9 items-center gap-2 bg-background/95 px-4 pb-1.5 pt-3 text-xs font-medium text-muted-foreground/75 backdrop-blur supports-[backdrop-filter]:bg-background/80">
708708
<span>{children}</span>
709-
{action ? (
710-
<span className="normal-case tracking-normal">{action}</span>
711-
) : null}
709+
{action ? <span>{action}</span> : null}
712710
</div>
713711
);
714712
}

‎desktop/src/features/sidebar/ui/AppSidebar.tsx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export function AppSidebar({
619619
</div>
620620

621621
<SidebarContent
622-
className="buzz-sidebar-scrollbar overscroll-none"
622+
className="buzz-sidebar-scrollbar overscroll-none pt-4"
623623
ref={scrollRef}
624624
>
625625
{isLoading ? (
@@ -716,9 +716,6 @@ export function AppSidebar({
716716
browseAriaLabel="Browse channels"
717717
createAriaLabel="Create a channel"
718718
draggable
719-
groupClassName={
720-
channelSections.length > 0 ? undefined : "pt-1"
721-
}
722719
hasUnread={unreadChannelIds.size > 0}
723720
isCollapsed={collapsedGroups.channels}
724721
isActiveChannel={selectedView === "channel"}
@@ -802,7 +799,7 @@ export function AppSidebar({
802799
presenceByChannelId={dmPresenceByChannelId}
803800
selectedChannelId={selectedChannelId}
804801
testId="dm-list"
805-
title="Direct Messages"
802+
title="Direct messages"
806803
unreadChannelCounts={unreadChannelCounts}
807804
unreadChannelIds={unreadChannelIds}
808805
mutedChannelIds={mutedChannelIds}

‎desktop/src/features/sidebar/ui/CustomChannelSection.tsx‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
GripVertical,
1212
Pencil,
1313
Plus,
14-
Search,
1514
Star,
1615
StarOff,
1716
Trash2,
@@ -48,6 +47,7 @@ import {
4847
import type { ChannelSection } from "@/features/sidebar/lib/useChannelSections";
4948
import type { Channel } from "@/shared/api/types";
5049
import { cn } from "@/shared/lib/cn";
50+
import { HashSearch } from "@/shared/ui/icons";
5151

5252
// ---------------------------------------------------------------------------
5353
// Shared styles
@@ -56,7 +56,7 @@ import { cn } from "@/shared/lib/cn";
5656
const SECTION_LABEL_BUTTON_CLASS =
5757
"group/section-label flex w-fit max-w-[calc(100%-3rem)] cursor-pointer appearance-none items-center gap-1 text-left transition-colors hover:text-sidebar-foreground focus-visible:text-sidebar-foreground";
5858
const SECTION_LABEL_CHEVRON_CLASS =
59-
"relative size-2.5 shrink-0 opacity-0 text-sidebar-foreground/45 transition-[color,opacity] group-hover/sidebar-section:opacity-100 group-hover/sidebar-section:text-sidebar-foreground group-hover/section-label:opacity-100 group-hover/section-label:text-sidebar-foreground group-focus-within/sidebar-section:opacity-100 group-focus-within/sidebar-section:text-sidebar-foreground group-focus-visible/section-label:opacity-100 group-focus-visible/section-label:text-sidebar-foreground";
59+
"relative size-2.5 shrink-0 text-current opacity-0 transition-[color,opacity] group-hover/sidebar-section:opacity-100 group-hover/section-label:opacity-100 group-focus-within/sidebar-section:opacity-100 group-focus-visible/section-label:opacity-100";
6060
const SECTION_LABEL_CHEVRON_ICON_CLASS =
6161
"absolute left-1/2 top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2";
6262

@@ -261,18 +261,24 @@ function SectionHeaderActions({
261261
{onBrowseClick ? (
262262
<button
263263
aria-label={browseAriaLabel}
264-
className={SECTION_ICON_BUTTON_CLASS}
264+
className={cn(
265+
SECTION_ICON_BUTTON_CLASS,
266+
SECTION_ACTION_VISIBILITY_CLASS,
267+
)}
265268
onClick={onBrowseClick}
266269
title={browseAriaLabel}
267270
type="button"
268271
>
269-
<Search className="h-4 w-4" />
272+
<HashSearch className="h-4 w-4" />
270273
</button>
271274
) : null}
272275
{onCreateClick ? (
273276
<button
274277
aria-label={createAriaLabel}
275-
className={SECTION_ICON_BUTTON_CLASS}
278+
className={cn(
279+
SECTION_ICON_BUTTON_CLASS,
280+
SECTION_ACTION_VISIBILITY_CLASS,
281+
)}
276282
onClick={onCreateClick}
277283
type="button"
278284
>
@@ -416,8 +422,8 @@ export function ChannelGroupSection({
416422
) : null;
417423

418424
const sectionContent = (
419-
<SidebarGroup className={groupClassName}>
420-
<div className="group/sidebar-section relative">
425+
<SidebarGroup className={cn("group/sidebar-section", groupClassName)}>
426+
<div className="relative">
421427
<SidebarGroupLabel asChild>
422428
<button
423429
aria-controls={contentId}
@@ -535,13 +541,12 @@ export function CustomChannelSection({
535541
<SortableSectionShell sectionId={section.id}>
536542
{({ dragHandleProps, isDragging }) => (
537543
<DroppableSectionBody sectionId={section.id}>
538-
<SidebarGroup className={cn(isDragging && "opacity-30")}>
544+
<SidebarGroup
545+
className={cn("group/sidebar-section", isDragging && "opacity-30")}
546+
>
539547
<ContextMenu>
540548
<ContextMenuTrigger asChild>
541-
<div
542-
className="group/sidebar-section relative"
543-
{...dragHandleProps}
544-
>
549+
<div className="relative" {...dragHandleProps}>
545550
<SidebarGroupLabel asChild>
546551
<button
547552
aria-controls={contentId}

‎desktop/src/features/sidebar/ui/SidebarSection.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { PresenceDot } from "@/features/presence/ui/PresenceBadge";
3535
const SECTION_LABEL_BUTTON_CLASS =
3636
"group/section-label flex w-fit max-w-[calc(100%-3rem)] cursor-pointer appearance-none items-center gap-1 text-left transition-colors hover:text-sidebar-foreground focus-visible:text-sidebar-foreground";
3737
const SECTION_LABEL_CHEVRON_CLASS =
38-
"relative size-2.5 shrink-0 opacity-0 text-sidebar-foreground/45 transition-[color,opacity] group-hover/sidebar-section:opacity-100 group-hover/sidebar-section:text-sidebar-foreground group-hover/section-label:opacity-100 group-hover/section-label:text-sidebar-foreground group-focus-within/sidebar-section:opacity-100 group-focus-within/sidebar-section:text-sidebar-foreground group-focus-visible/section-label:opacity-100 group-focus-visible/section-label:text-sidebar-foreground";
38+
"relative size-2.5 shrink-0 text-current opacity-0 transition-[color,opacity] group-hover/sidebar-section:opacity-100 group-hover/section-label:opacity-100 group-focus-within/sidebar-section:opacity-100 group-focus-visible/section-label:opacity-100";
3939
const SECTION_LABEL_CHEVRON_ICON_CLASS =
4040
"absolute left-1/2 top-1/2 size-2.5 -translate-x-1/2 -translate-y-1/2";
4141
const SIDEBAR_ROW_ACTION_VISIBILITY_CLASS =
@@ -303,8 +303,8 @@ export function SidebarSection({
303303
const canToggle = Boolean(onToggleCollapsed);
304304

305305
return (
306-
<SidebarGroup>
307-
<div className="group/sidebar-section relative">
306+
<SidebarGroup className="group/sidebar-section">
307+
<div className="relative">
308308
<SidebarGroupLabel asChild={canToggle}>
309309
{canToggle ? (
310310
<button

‎desktop/src/shared/ui/icons.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createLucideIcon } from "lucide-react";
2+
3+
export const HashSearch = createLucideIcon("hash-search", [
4+
["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "pulu6f" }],
5+
["line", { x1: "4", x2: "11", y1: "15", y2: "15", key: "th0qa4" }],
6+
["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
7+
["line", { x1: "16", x2: "15", y1: "3", y2: "12", key: "noe5so" }],
8+
["path", { d: "m21 21-1.9-1.9", key: "1g2n9r" }],
9+
["circle", { cx: "17", cy: "17", r: "3", key: "18b49y" }],
10+
]);

0 commit comments

Comments
 (0)