Skip to content

Commit 85b6d03

Browse files
✨ Feat(web): better UI for migrate event buttons (#574)
* feat(web): switch migrate buttons to phosphor icons, capitalize 'Ctrl' key for better UI * fix(web): add margin between icons and title field things were looking a little too tight after we changed migrate buttons icons to phosphoricons * feat(web): add ids to migrate buttons helps with making sure the tests pass since some tests depends on querying the id of the element * feat(web): update grid event form's move to sidebar button icon to be consistent with migrate buttons in someday event form * feat(web): change icons for event migration buttons resolves feedback for #574 (comment)
1 parent 5cf91a4 commit 85b6d03

File tree

4 files changed

+53
-19
lines changed

4 files changed

+53
-19
lines changed

packages/web/src/views/Forms/EventForm/MigrateBackwardButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import styled from "styled-components";
3+
import { ArrowLeft } from "@phosphor-icons/react";
34
import { getMetaKey } from "@web/common/utils/shortcut.util";
45
import { Text } from "@web/components/Text";
56
import TooltipIconButton from "@web/components/TooltipIconButton/TooltipIconButton";
@@ -11,6 +12,11 @@ const StyledMigrateBackwardButton = styled.div`
1112
}
1213
`;
1314

15+
const StyledArrowLeft = styled(ArrowLeft)`
16+
width: 15px;
17+
height: 15px;
18+
`;
19+
1420
export const MigrateBackwardButton = ({
1521
onClick,
1622
tooltipText = "Migrate Backward",
@@ -31,7 +37,7 @@ export const MigrateBackwardButton = ({
3137
onClick,
3238
shortcut: (
3339
<Text size="s" style={{ display: "flex", alignItems: "center" }}>
34-
Ctrl + {getMetaKey()} + Left
40+
CTRL + {getMetaKey()} + <StyledArrowLeft />
3541
</Text>
3642
),
3743
}}

packages/web/src/views/Forms/EventForm/MigrateForwardButton.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import styled from "styled-components";
3+
import { ArrowRight } from "@phosphor-icons/react";
34
import { getMetaKey } from "@web/common/utils/shortcut.util";
45
import { Text } from "@web/components/Text";
56
import TooltipIconButton from "@web/components/TooltipIconButton/TooltipIconButton";
@@ -11,6 +12,11 @@ const StyledMigrateForwardButton = styled.div`
1112
}
1213
`;
1314

15+
const StyledArrowRight = styled(ArrowRight)`
16+
width: 15px;
17+
height: 15px;
18+
`;
19+
1420
export const MigrateForwardButton = ({
1521
onClick,
1622
tooltipText = "Migrate Forward",
@@ -31,7 +37,7 @@ export const MigrateForwardButton = ({
3137
onClick,
3238
shortcut: (
3339
<Text size="s" style={{ display: "flex", alignItems: "center" }}>
34-
Ctrl + {getMetaKey()} + Right
40+
CTRL + {getMetaKey()} + <StyledArrowRight />
3541
</Text>
3642
),
3743
}}
Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
11
import React from "react";
2+
import styled from "styled-components";
3+
import { ArrowLeft } from "@phosphor-icons/react";
24
import { getMetaKey } from "@web/common/utils/shortcut.util";
35
import { Text } from "@web/components/Text";
4-
import { TooltipWrapper } from "@web/components/Tooltip/TooltipWrapper";
5-
import { StyledMigrateArrowInForm } from "@web/views/Calendar/components/Sidebar/SomedayTab/SomedayEvents/SomedayEventContainer/styled";
6+
import TooltipIconButton from "@web/components/TooltipIconButton/TooltipIconButton";
67

7-
export const MoveToSidebarButton = ({ onClick }: { onClick: () => void }) => {
8-
const getShortcut = () => {
9-
return (
10-
<Text size="s" style={{ display: "flex", alignItems: "center" }}>
11-
{getMetaKey()} +{" SHIFT "} + {","}
12-
</Text>
13-
);
14-
};
8+
const StyledMoveToSidebarButton = styled.div`
9+
font-size: 25px;
10+
&:hover {
11+
cursor: pointer;
12+
}
13+
`;
1514

15+
const StyledArrowLeft = styled(ArrowLeft)`
16+
width: 15px;
17+
height: 15px;
18+
`;
19+
20+
export const MoveToSidebarButton = ({
21+
onClick,
22+
tooltipText = "Move To Sidebar",
23+
}: {
24+
onClick: () => void;
25+
tooltipText?: string;
26+
}) => {
1627
return (
17-
<TooltipWrapper
18-
onClick={onClick}
19-
description="Move to sidebar"
20-
shortcut={getShortcut()}
21-
>
22-
<StyledMigrateArrowInForm role="button">{"<"}</StyledMigrateArrowInForm>
23-
</TooltipWrapper>
28+
<TooltipIconButton
29+
component={
30+
<StyledMoveToSidebarButton id="migrate-backward-button" role="button">
31+
{"<"}
32+
</StyledMoveToSidebarButton>
33+
}
34+
buttonProps={{ "aria-label": tooltipText }}
35+
tooltipProps={{
36+
description: tooltipText,
37+
onClick,
38+
shortcut: (
39+
<Text size="s" style={{ display: "flex", alignItems: "center" }}>
40+
CTRL + {getMetaKey()} + <StyledArrowLeft />
41+
</Text>
42+
),
43+
}}
44+
/>
2445
);
2546
};

packages/web/src/views/Forms/EventForm/styled.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const StyledIconRow = styled(Flex)`
4242
align-items: center;
4343
gap: 30px;
4444
justify-content: end;
45+
margin-bottom: 10px;
4546
`;
4647

4748
export const StyledSubmitButton = styled(PriorityButton)`

0 commit comments

Comments
 (0)