Skip to content

Commit eb5d4c4

Browse files
committed
tweak window button shadows & highlights
1 parent 9356edf commit eb5d4c4

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

src/components/BorderedApp/BorderedApp.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,19 @@ function BorderedApp<
178178
<StyledWindowButton
179179
buttonType="min"
180180
onClick={minimize}
181-
></StyledWindowButton>
181+
frameColor={mainColor}
182+
/>
183+
182184
<StyledWindowButton
183185
buttonType="max"
184186
onClick={maximize}
185-
></StyledWindowButton>
187+
frameColor={mainColor}
188+
/>
186189
<StyledWindowButton
187190
buttonType="close"
188191
onClick={onClickClose}
189-
></StyledWindowButton>
192+
frameColor={mainColor}
193+
/>
190194
</StyledWindowButtons>
191195
</StyledWindowButtonsWrapper>
192196
</StyledTitleBar>

src/components/BorderedApp/styles.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from "@emotion/styled";
22
import { Dimensions, Position } from "../../hooks/useDragToResize";
3-
import { transparentize } from "polished";
3+
import { darken, transparentize } from "polished";
44

55
interface StyledBorderedAppProps {
66
initialDimensions: Dimensions;
@@ -24,7 +24,7 @@ export const StyledBorderedApp = styled.div<StyledBorderedAppProps>`
2424
border-radius: 10px;
2525
box-shadow:
2626
0px -2px 10px 1px rgb(0, 0, 0, 0.4),
27-
0px 0px 3px rgb(141, 141, 141, 0.5) inset;
27+
0px 0px 3px ${transparentize(0.5, "#8d8d8d")} inset;
2828
position: fixed;
2929
width: ${(props) => props.initialDimensions.width}px;
3030
height: ${(props) => props.initialDimensions.height}px;
@@ -126,9 +126,11 @@ function getButtonBackgroundColor(type: ButtonType): string {
126126
}
127127
}
128128

129-
export const StyledWindowButton = styled.button<{
129+
interface StyledWindowButtonProps {
130130
buttonType: ButtonType;
131-
}>`
131+
frameColor: string;
132+
}
133+
export const StyledWindowButton = styled.button<StyledWindowButtonProps>`
132134
border-radius: 20px;
133135
width: 14px;
134136
height: 14px;
@@ -137,12 +139,21 @@ export const StyledWindowButton = styled.button<{
137139
transition: all 0.2s ease;
138140
background-color: ${(props) => getButtonBackgroundColor(props.buttonType)};
139141
border: none;
142+
box-shadow:
143+
inset 0 0 0 0.5px ${(p) => transparentize(0.5, darken(0.1, p.frameColor))},
144+
inset 0 1px 2px rgba(255, 255, 255, 0.3),
145+
0 1px 5px ${(p) => transparentize(0.5, darken(0.1, p.frameColor))};
146+
140147
&:hover {
141148
transform: scale(1.2);
142149
transition: all 0.2s ease;
143150
}
144151
&:active {
145-
box-shadow: 2px 2px 4px rgb(0, 0, 0, 0.5) inset;
152+
box-shadow:
153+
inset 1px 1px 2px 1px
154+
${(p) => transparentize(0.5, darken(0.1, p.frameColor))},
155+
inset 0 1px 2px ${(p) => transparentize(0.5, darken(0.1, p.frameColor))},
156+
0 1px 5px ${(p) => transparentize(0.5, darken(0.1, p.frameColor))};
146157
}
147158
`;
148159

0 commit comments

Comments
 (0)