Skip to content

Commit 889100e

Browse files
committed
♻️ Refactor: Update icon color handling
This removes the isFocused props, resolving devtools error
1 parent 1c51c5b commit 889100e

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

packages/web/src/components/Icons/styled.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { css } from "styled-components";
22
import { IconProps } from "@phosphor-icons/react";
33

4-
interface Props extends IconProps {
5-
isFocused: boolean;
6-
}
7-
8-
export const iconStyles = css<Props>`
9-
color: ${({ theme, isFocused }) =>
10-
isFocused ? theme.color.text.light : theme.color.text.lightInactive};
4+
export const iconStyles = css<IconProps>`
115
transition: filter 0.2s ease;
126
137
&:hover {

packages/web/src/views/Calendar/components/Header/Header.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import dayjs, { Dayjs } from "dayjs";
22
import React, { FC } from "react";
3+
import { theme } from "@web/common/styles/theme";
34
import { getCalendarHeadingLabel } from "@web/common/utils/web.date.util";
45
import { AlignItems } from "@web/components/Flex/styled";
56
import { SidebarIcon } from "@web/components/Icons/Sidebar";
@@ -59,7 +60,13 @@ export const Header: FC<Props> = ({
5960
onClick={() => dispatch(viewSlice.actions.toggleSidebar())}
6061
shortcut="["
6162
>
62-
<SidebarIcon isFocused={isSidebarOpen} />
63+
<SidebarIcon
64+
color={
65+
isSidebarOpen
66+
? theme.color.text.light
67+
: theme.color.text.lightInactive
68+
}
69+
/>
6370
</TooltipWrapper>
6471
<StyledLeftGroup>
6572
<StyledHeaderLabel aria-level={1} role="heading">

packages/web/src/views/Calendar/components/Sidebar/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Sidebar: FC<Props & React.HTMLAttributes<HTMLDivElement>> = ({
5252
/>
5353
)}
5454
</SidebarTabContainer>
55-
{/* <SidebarIconRow /> */}
55+
<SidebarIconRow />
5656
</SidebarContainer>
5757
);
5858
};

packages/web/src/views/Calendar/components/Sidebar/SidebarIconRow/SidebarIconRow.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import React from "react";
2+
import { Command } from "@phosphor-icons/react";
3+
import { theme } from "@web/common/styles/theme";
24
import { CalendarIcon } from "@web/components/Icons/Calendar";
35
import { CommandIcon } from "@web/components/Icons/Command";
46
import { TodoIcon } from "@web/components/Icons/Todo";
@@ -32,14 +34,26 @@ export const SidebarIconRow = () => {
3234
shortcut="CMD + K"
3335
onClick={toggleCmdPalette}
3436
>
35-
<CommandIcon isFocused={isCmdPaletteOpen} />
37+
<CommandIcon
38+
color={
39+
isCmdPaletteOpen
40+
? theme.color.text.darkPlaceholder
41+
: theme.color.text.light
42+
}
43+
/>
3644
</TooltipWrapper>
3745
<TooltipWrapper
3846
description="Open tasks"
3947
shortcut="SHIFT + 1"
4048
onClick={() => dispatch(viewSlice.actions.updateSidebarTab("tasks"))}
4149
>
42-
<TodoIcon isFocused={tab === "tasks"} />
50+
<TodoIcon
51+
color={
52+
tab === "tasks"
53+
? theme.color.text.light
54+
: theme.color.text.darkPlaceholder
55+
}
56+
/>
4357
</TooltipWrapper>
4458
<TooltipWrapper
4559
description="Open month"
@@ -48,7 +62,13 @@ export const SidebarIconRow = () => {
4862
dispatch(viewSlice.actions.updateSidebarTab("monthWidget"))
4963
}
5064
>
51-
<CalendarIcon isFocused={tab === "monthWidget"} />
65+
<CalendarIcon
66+
color={
67+
tab === "monthWidget"
68+
? theme.color.text.light
69+
: theme.color.text.darkPlaceholder
70+
}
71+
/>
5272
</TooltipWrapper>
5373
</LeftIconGroup>
5474
</IconRow>

0 commit comments

Comments
 (0)