Skip to content

Commit 9418162

Browse files
committed
Refactor BottomBar to use styled components
1 parent 1e594f7 commit 9418162

5 files changed

Lines changed: 66 additions & 60 deletions

File tree

src/components/BottomBar/BottomBar.scss

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/components/BottomBar/BottomBar.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@ import TextEditorLauncher from "../../programs/TextEditor/TextEditorLauncher";
55
import WebBrowserLauncher from "../../programs/WebBrowser/WebBrowserLauncher";
66
import useSystemSettings from "../../stores/systemSettingsStore";
77

8-
import "./BottomBar.scss";
8+
import {
9+
StyledBottomBar,
10+
StyledContainer,
11+
StyledContents,
12+
} from "./Styled.BottomBar";
913

1014
interface BottomBarProps {}
1115

1216
// eslint-disable-next-line no-empty-pattern
1317
function BottomBar({}: BottomBarProps) {
1418
const settings = useSystemSettings();
1519
return (
16-
<div id="bottom-bar__container">
17-
<div id="bottom-bar" style={{ backgroundColor: settings.mainColor }}>
18-
<div id="bottom-bar__contents">
20+
<StyledContainer id="bottom-bar__container">
21+
<StyledBottomBar id="bottom-bar" backgroundColor={settings.mainColor}>
22+
<StyledContents id="bottom-bar__contents">
1923
<TextEditorLauncher />
2024
<CalculatorLauncher />
2125
<WebBrowserLauncher />
2226
<FileBrowserLauncher />
2327
<SettingsLauncher />
24-
</div>
25-
</div>
26-
</div>
28+
</StyledContents>
29+
</StyledBottomBar>
30+
</StyledContainer>
2731
);
2832
}
2933

src/components/BottomBar/Launcher/Launcher.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import BorderedApp from "../../BorderedApp";
77
import { Dimensions } from "../../../hooks/useDragToResize";
88
import { MenuItemProps } from "../../MenuItems";
99

10-
import "./Launcher.scss";
10+
import { StyledIcon, StyledLauncher } from "./Styled.Launcher";
1111
interface LauncherProps {
1212
windowType: string;
1313
WindowTitle: string;
@@ -77,9 +77,13 @@ function Launcher({
7777
});
7878

7979
return (
80-
<div ref={ref} tabIndex={1} className="launcher">
81-
<img src={icon} className="launcher-icon" alt={windowType}></img>
82-
</div>
80+
<StyledLauncher ref={ref} tabIndex={1} className="launcher">
81+
<StyledIcon
82+
src={icon}
83+
className="launcher-icon"
84+
alt={windowType}
85+
></StyledIcon>
86+
</StyledLauncher>
8387
);
8488
}
8589

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
.launcher {
1+
import styled from "@emotion/styled";
2+
3+
export const StyledLauncher = styled.div`
24
min-width: 0;
35
height: 100% !important;
46
aspect-ratio: 1/1;
@@ -11,17 +13,16 @@
1113
justify-content: center;
1214
vertical-align: middle;
1315
box-shadow: 0px -2px 10px 1px rgb(0, 0, 0, 0.5);
14-
15-
&-icon {
16-
width: 100%;
17-
height: 100%;
18-
}
19-
2016
transform: scale(1);
2117
transition: all 0.2s ease;
2218
&:hover {
2319
box-shadow: 0px 0px 10px 5px rgb(0, 0, 0, 0.5);
2420
transform: scale(1.3);
2521
transition: all 0.2s ease;
2622
}
27-
}
23+
`;
24+
25+
export const StyledIcon = styled.img`
26+
width: 100%;
27+
height: 100%;
28+
`;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import styled from "@emotion/styled";
2+
3+
export const StyledContainer = styled.div`
4+
min-height: 0;
5+
min-width: 0;
6+
grid-area: bottom-bar;
7+
width: 100%;
8+
height: 100%;
9+
padding: 10px;
10+
padding-top: 0;
11+
display: flex;
12+
box-sizing: border-box;
13+
justify-content: center;
14+
align-items: center;
15+
`;
16+
17+
export const StyledBottomBar = styled.div<{ backgroundColor: string }>`
18+
height: 100%;
19+
width: 100%;
20+
display: flex;
21+
background-color: var(--ui-color-primary);
22+
border-radius: 50px;
23+
background-color: #2e3440;
24+
box-shadow: 0 -2px 10px 1px #11172b, 0 -2px 3px #bebebe inset;
25+
background-color: ${(props) => props.backgroundColor};
26+
`;
27+
28+
export const StyledContents = styled.div`
29+
padding: 10px 10px;
30+
box-sizing: border-box;
31+
display: flex;
32+
flex-direction: row;
33+
justify-content: center;
34+
align-items: flex-start;
35+
gap: 10px;
36+
width: 100%;
37+
height: 100%;
38+
`;

0 commit comments

Comments
 (0)