Skip to content

Commit 4b053b3

Browse files
committed
fix(cortex): pixel-perfect CortexActivityBar matching Figma Sidebar Container
- Reorder DEFAULT_ITEMS to Figma order: home, folder, search, git, play, plugins, users, grid, book, map, brush (11 items) - Active state: bg #BFFF00, icon #141415 - Inactive icon #8C8D8F, hover #FCFCFC - Border: 1px solid #2E2F31 - Settings icon: settings-02, hover color #FCFCFC - Avatar: 24x24 with 6x6 green (#34D399) status dot - Remove bottom section border-top divider - Badge colors: #BFFF00/#141415 - Update cortex-tokens: icon-active #141415 - Update both test files for new item count/order
1 parent b2f1f58 commit 4b053b3

4 files changed

Lines changed: 46 additions & 35 deletions

File tree

src/components/__tests__/CortexActivityBar.test.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,20 @@ describe("CortexActivityBar Component Logic", () => {
5757

5858
const DEFAULT_ITEMS: ActivityBarItem[] = [
5959
{ id: "home", icon: "home", label: "Home" },
60-
{ id: "new", icon: "plus", label: "New" },
6160
{ id: "files", icon: "folder", label: "Explorer" },
61+
{ id: "search", icon: "search", label: "Search" },
6262
{ id: "git", icon: "git", label: "Source Control" },
6363
{ id: "debug", icon: "play", label: "Run & Debug" },
64-
{ id: "extensions", icon: "box", label: "Extensions" },
64+
{ id: "plugins", icon: "plugins", label: "Plugins" },
6565
{ id: "agents", icon: "users", label: "AI Agents" },
66-
{ id: "packages", icon: "cube", label: "Packages" },
67-
{ id: "factory", icon: "grid", label: "Factory" },
66+
{ id: "extensions", icon: "grid", label: "Extensions" },
6867
{ id: "docs", icon: "book", label: "Documentation" },
69-
{ id: "maps", icon: "map", label: "Code Maps" },
70-
{ id: "themes", icon: "paintbrush", label: "Themes" },
68+
{ id: "factory", icon: "map", label: "Factory" },
69+
{ id: "themes", icon: "brush", label: "Themes" },
7170
];
7271

73-
it("should have 12 default items", () => {
74-
expect(DEFAULT_ITEMS).toHaveLength(12);
72+
it("should have 11 default items", () => {
73+
expect(DEFAULT_ITEMS).toHaveLength(11);
7574
});
7675

7776
it("should start with home item", () => {
@@ -86,8 +85,8 @@ describe("CortexActivityBar Component Logic", () => {
8685
const ids = DEFAULT_ITEMS.map(item => item.id);
8786

8887
expect(ids).toContain("home");
89-
expect(ids).toContain("new");
9088
expect(ids).toContain("files");
89+
expect(ids).toContain("search");
9190
expect(ids).toContain("git");
9291
expect(ids).toContain("debug");
9392
expect(ids).toContain("extensions");

src/components/cortex/CortexActivityBar.tsx

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/**
22
* CortexActivityBar - Pixel-perfect activity bar matching Figma Sidebar Container (37:893)
3-
* Width: 40px, border-radius 12px, sidebar bg/border from tokens
3+
* Width: 40px, border-radius 12px, bg #1C1C1D, border 1px solid #2E2F31
44
* Items: 32×32 containers, 20×20 icons, 8px gap, 4px padding
5-
* Active state: sidebar-selected bg (#252628) with white icon (#FCFCFC)
6-
* Bottom section: settings + avatar pinned to bottom
5+
* Active state: lime accent bg (#BFFF00) with dark icon (#141415), border-radius 8px
6+
* Inactive: #8C8D8F, hover: #FCFCFC
7+
* Bottom section: settings (settings-02) + avatar circle (24×24) with green status dot
78
*/
89

910
import { Component, JSX, splitProps, createSignal, For, Show } from "solid-js";
@@ -36,11 +37,12 @@ const DEFAULT_ITEMS: ActivityBarItem[] = [
3637
{ id: "search", icon: "search", label: "Search" },
3738
{ id: "git", icon: "git", label: "Source Control" },
3839
{ id: "debug", icon: "play", label: "Run & Debug" },
39-
{ id: "extensions", icon: "grid", label: "Extensions" },
40+
{ id: "plugins", icon: "plugins", label: "Plugins" },
4041
{ id: "agents", icon: "users", label: "AI Agents" },
42+
{ id: "extensions", icon: "grid", label: "Extensions" },
43+
{ id: "docs", icon: "book", label: "Documentation" },
4144
{ id: "factory", icon: "map", label: "Factory" },
42-
{ id: "plugins", icon: "puzzle-piece", label: "Plugins" },
43-
{ id: "themes", icon: "paintbrush", label: "Themes" },
45+
{ id: "themes", icon: "brush", label: "Themes" },
4446
];
4547

4648
export const CortexActivityBar: Component<CortexActivityBarProps> = (props) => {
@@ -67,7 +69,7 @@ export const CortexActivityBar: Component<CortexActivityBarProps> = (props) => {
6769
"margin-bottom": "var(--cortex-space-2)",
6870
background: "var(--cortex-sidebar-bg)",
6971
"border-radius": "var(--cortex-sidebar-radius)",
70-
border: "1px solid var(--cortex-sidebar-border)",
72+
border: "1px solid #2E2F31",
7173
padding: "var(--cortex-space-1)",
7274
"flex-shrink": "0",
7375
...local.style,
@@ -104,7 +106,6 @@ export const CortexActivityBar: Component<CortexActivityBarProps> = (props) => {
104106
"align-items": "center",
105107
padding: "0",
106108
gap: "var(--cortex-space-2)",
107-
"border-top": "1px solid var(--cortex-sidebar-border)",
108109
}}>
109110
<ActivityBarSettingsButton onClick={local.onSettingsClick} />
110111
<AvatarButton
@@ -134,14 +135,15 @@ const ActivityBarButton: Component<ActivityBarButtonProps> = (props) => {
134135
const [isHovered, setIsHovered] = createSignal(false);
135136

136137
const bg = () => {
137-
if (props.isActive) return "var(--cortex-sidebar-selected)";
138+
if (props.isActive) return "#BFFF00";
138139
if (isHovered()) return "var(--cortex-sidebar-selected)";
139140
return "transparent";
140141
};
141142

142143
const iconColor = () => {
143-
if (props.isActive) return "var(--cortex-text-on-surface)";
144-
return "var(--cortex-icon-inactive)";
144+
if (props.isActive) return "#141415";
145+
if (isHovered()) return "#FCFCFC";
146+
return "#8C8D8F";
145147
};
146148

147149
return (
@@ -185,8 +187,8 @@ const ActivityBarButton: Component<ActivityBarButtonProps> = (props) => {
185187
"align-items": "center",
186188
"justify-content": "center",
187189
padding: "0 var(--cortex-space-1)",
188-
background: "var(--cortex-accent-primary)",
189-
color: "var(--cortex-accent-text)",
190+
background: "#BFFF00",
191+
color: "#141415",
190192
"font-family": "var(--cortex-font-sans)",
191193
"font-size": "9px",
192194
"font-weight": "var(--cortex-font-semibold)",
@@ -231,11 +233,9 @@ const ActivityBarSettingsButton: Component<{ onClick?: () => void }> = (props) =
231233
aria-label="Settings"
232234
>
233235
<CortexIcon
234-
name="gear"
236+
name="settings-02"
235237
size={20}
236-
color={isHovered()
237-
? "var(--cortex-accent-primary)"
238-
: "var(--cortex-icon-inactive)"}
238+
color={isHovered() ? "#FCFCFC" : "#8C8D8F"}
239239
style={{ transition: "color var(--cortex-transition-fast)" }}
240240
/>
241241
</button>
@@ -250,18 +250,19 @@ const AvatarButton: Component<{ avatarUrl?: string; onClick?: () => void }> = (p
250250
<CortexTooltip content="Account" position="right">
251251
<button
252252
style={{
253-
width: "var(--cortex-space-8)",
254-
height: "var(--cortex-space-8)",
253+
position: "relative",
254+
width: "24px",
255+
height: "24px",
255256
"border-radius": "var(--cortex-radius-full)",
256257
background: "var(--cortex-bg-tertiary)",
257258
border: isHovered()
258-
? "2px solid var(--cortex-accent-primary)"
259-
: "2px solid var(--cortex-border-default)",
259+
? "2px solid #BFFF00"
260+
: "2px solid transparent",
260261
cursor: "pointer",
261262
display: "flex",
262263
"align-items": "center",
263264
"justify-content": "center",
264-
overflow: "hidden",
265+
overflow: "visible",
265266
transition: "border-color var(--cortex-transition-fast)",
266267
padding: "0",
267268
}}
@@ -275,8 +276,8 @@ const AvatarButton: Component<{ avatarUrl?: string; onClick?: () => void }> = (p
275276
fallback={
276277
<CortexIcon
277278
name="user"
278-
size={18}
279-
color="var(--cortex-text-muted)"
279+
size={14}
280+
color="#8C8D8F"
280281
/>
281282
}
282283
>
@@ -287,9 +288,20 @@ const AvatarButton: Component<{ avatarUrl?: string; onClick?: () => void }> = (p
287288
width: "100%",
288289
height: "100%",
289290
"object-fit": "cover",
291+
"border-radius": "var(--cortex-radius-full)",
290292
}}
291293
/>
292294
</Show>
295+
<span style={{
296+
position: "absolute",
297+
bottom: "-1px",
298+
right: "-1px",
299+
width: "6px",
300+
height: "6px",
301+
"border-radius": "var(--cortex-radius-full)",
302+
background: "#34D399",
303+
border: "1px solid var(--cortex-sidebar-bg)",
304+
}} />
293305
</button>
294306
</CortexTooltip>
295307
);

src/components/cortex/__tests__/CortexActivityBar.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("CortexActivityBar", () => {
6565
it("should render with default items when no items provided", () => {
6666
const { container } = render(() => <CortexActivityBar />);
6767
const buttons = container.querySelectorAll('button[aria-label]');
68-
expect(buttons.length).toBeGreaterThanOrEqual(12);
68+
expect(buttons.length).toBeGreaterThanOrEqual(13);
6969
});
7070

7171
it("should render custom items when provided", () => {

src/styles/cortex-tokens.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
--cortex-text-on-surface: #FCFCFC; /* Text on dark surfaces */
207207
--cortex-card-border: rgba(255, 255, 255, 0.15); /* Standard card border */
208208
--cortex-icon-inactive: #8C8D8F; /* Inactive sidebar icons (Figma exact) */
209-
--cortex-icon-active: #000000; /* Active icon on accent bg */
209+
--cortex-icon-active: #141415; /* Active icon on accent bg (Figma exact) */
210210

211211
/* Font Sizes (Figma: 10, 12, 14, 16) */
212212
--cortex-text-2xs: 10px; /* Figma smallest text */

0 commit comments

Comments
 (0)