Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit af11acd

Browse files
chore: added hover animation to mac traffic lights
1 parent 57a8216 commit af11acd

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

src/renderer/components/Layout/TitlebarButtonsMac.tsx

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
import { Flex, Image } from '@chakra-ui/react';
2-
import { DotIcon } from '@codiga/components';
1+
import { Flex, Icon, IconProps, Image } from '@chakra-ui/react';
32
import TitlebarButton from './TitlebarButton';
43
import CodigaLogo from './CodigaIcon.png';
54

5+
const iconStyles: IconProps = {
6+
width: '12px',
7+
height: '12px',
8+
viewBox: '0 0 12 12',
9+
fill: 'none',
10+
xmlns: 'http://www.w3.org/2000/svg',
11+
};
12+
13+
const hoverStyles: IconProps = {
14+
position: 'absolute',
15+
opacity: 0,
16+
transition: 'ease-in-out',
17+
transitionDuration: '100ms',
18+
_groupHover: { opacity: 1 },
19+
};
20+
621
export default function TitlebarActionsMac() {
722
if (!window.electron?.isMac) {
823
return <Image src={CodigaLogo} h="24px" ml="space_16" />;
@@ -14,24 +29,65 @@ export default function TitlebarActionsMac() {
1429
ml="space_16"
1530
sx={{ '-webkit-app-region': 'no-drag' }}
1631
>
17-
<TitlebarButton message="closeApp" boxShadow="none !important" h="12px">
18-
<DotIcon h="12px" w="12px" color="#f96057" />
32+
<TitlebarButton
33+
message="closeApp"
34+
boxShadow="none !important"
35+
h="12px"
36+
role="group"
37+
>
38+
<Icon {...iconStyles}>
39+
<circle cx="6" cy="6" r="6" fill="#FF4A4A" />
40+
</Icon>
41+
<Icon {...iconStyles} {...hoverStyles}>
42+
<path
43+
opacity="0.5"
44+
d="M6.70432 5.99957L8.85224 3.85634C8.9463 3.76227 8.99915 3.63467 8.99915 3.50163C8.99915 3.36859 8.9463 3.241 8.85224 3.14692C8.75818 3.05285 8.63061 3 8.49759 3C8.36456 3 8.23699 3.05285 8.14293 3.14692L6 5.29515L3.85707 3.14692C3.76301 3.05285 3.63544 3 3.50241 3C3.36939 3 3.24182 3.05285 3.14776 3.14692C3.0537 3.241 3.00085 3.36859 3.00085 3.50163C3.00085 3.63467 3.0537 3.76227 3.14776 3.85634L5.29568 5.99957L3.14776 8.14281C3.10094 8.18925 3.06378 8.24451 3.03842 8.30538C3.01306 8.36626 3 8.43156 3 8.49752C3 8.56347 3.01306 8.62877 3.03842 8.68965C3.06378 8.75052 3.10094 8.80578 3.14776 8.85222C3.19419 8.89905 3.24944 8.93622 3.31031 8.96158C3.37118 8.98694 3.43647 9 3.50241 9C3.56836 9 3.63365 8.98694 3.69452 8.96158C3.75539 8.93622 3.81063 8.89905 3.85707 8.85222L6 6.70399L8.14293 8.85222C8.18937 8.89905 8.24461 8.93622 8.30548 8.96158C8.36635 8.98694 8.43164 9 8.49759 9C8.56353 9 8.62882 8.98694 8.68969 8.96158C8.75056 8.93622 8.80581 8.89905 8.85224 8.85222C8.89906 8.80578 8.93622 8.75052 8.96158 8.68965C8.98694 8.62877 9 8.56347 9 8.49752C9 8.43156 8.98694 8.36626 8.96158 8.30538C8.93622 8.24451 8.89906 8.18925 8.85224 8.14281L6.70432 5.99957Z"
45+
fill="black"
46+
/>
47+
</Icon>
1948
</TitlebarButton>
2049

2150
<TitlebarButton
2251
message="minimizeApp"
2352
boxShadow="none !important"
2453
h="12px"
54+
role="group"
2555
>
26-
<DotIcon h="12px" w="12px" color="#f8ce52" />
56+
<Icon {...iconStyles}>
57+
<circle cx="6" cy="6" r="6" fill="#FFB83D" />
58+
</Icon>
59+
<Icon {...iconStyles} {...hoverStyles}>
60+
<path
61+
opacity="0.5"
62+
fillRule="evenodd"
63+
clipRule="evenodd"
64+
d="M2 5.7C2 5.3134 2.35817 5 2.8 5H9.2C9.64183 5 10 5.3134 10 5.7C10 6.0866 9.64183 6.4 9.2 6.4H2.8C2.35817 6.4 2 6.0866 2 5.7Z"
65+
fill="black"
66+
/>
67+
</Icon>
2768
</TitlebarButton>
2869

2970
<TitlebarButton
3071
message="maximizeApp"
3172
boxShadow="none !important"
3273
h="12px"
74+
role="group"
3375
>
34-
<DotIcon h="12px" w="12px" color="#5fcf65" />
76+
<Icon {...iconStyles}>
77+
<circle cx="6" cy="6" r="6" fill="#00C543" />
78+
</Icon>
79+
<Icon {...iconStyles} {...hoverStyles}>
80+
<g opacity="0.5">
81+
<path
82+
d="M7.90909 3L3 7.90909V4C3 3.44772 3.44772 3 4 3H7.90909Z"
83+
fill="black"
84+
/>
85+
<path
86+
d="M4.09091 9L9 4.09091L9 8C9 8.55228 8.55228 9 8 9L4.09091 9Z"
87+
fill="black"
88+
/>
89+
</g>
90+
</Icon>
3591
</TitlebarButton>
3692
</Flex>
3793
);

0 commit comments

Comments
 (0)