Skip to content

Commit 1e594f7

Browse files
committed
Refactor TopBar to use styled components
1 parent 5eb4a6a commit 1e594f7

20 files changed

Lines changed: 118 additions & 182 deletions

src/App.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ function App() {
99
<div className="App">
1010
<Global
1111
styles={css`
12-
background-color: ${settings.mainColor};
13-
color: ${settings.fontColor};
12+
body {
13+
color: ${settings.fontColor};
14+
}
1415
`}
1516
/>
1617
<Desktop />

src/components/Desktop/Desktop.scss

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

src/components/Desktop/Desktop.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
1-
import styled from "@emotion/styled";
2-
31
import TopBar from "../TopBar";
42
import Content from "../Content";
53
import BottomBar from "../BottomBar";
64
import useSystemSettings from "../../stores/systemSettingsStore";
75

8-
interface DesktopProps {}
9-
10-
const StyledDesktop = styled.div`
11-
height: 100dvh;
12-
width: 100dvw;
13-
display: grid;
14-
grid-template-rows: 42px auto 84px;
15-
grid-template-columns: auto;
16-
grid-template-areas:
17-
"top-bar"
18-
"content"
19-
"bottom-bar";
20-
gap: 10px;
21-
`;
6+
import { StyledBackground, StyledDesktop } from "./Styled.Desktop";
227

23-
const StyledBackground = styled.div<{ backgroundUrl: string }>`
24-
height: 100%;
25-
width: 100%;
26-
position: absolute;
27-
grid-area: none;
28-
z-index: -1;
29-
background-image: url(${(props) => props.backgroundUrl});
30-
background-size: cover;
31-
background-repeat: no-repeat;
32-
background-position: center;
33-
`;
8+
interface DesktopProps {}
349

3510
// eslint-disable-next-line no-empty-pattern
3611
function Desktop({}: DesktopProps) {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import styled from "@emotion/styled";
2+
3+
export const StyledDesktop = styled.div`
4+
height: 100dvh;
5+
width: 100dvw;
6+
display: grid;
7+
grid-template-rows: 42px auto 84px;
8+
grid-template-columns: auto;
9+
grid-template-areas:
10+
"top-bar"
11+
"content"
12+
"bottom-bar";
13+
gap: 10px;
14+
`;
15+
16+
export const StyledBackground = styled.div<{ backgroundUrl: string }>`
17+
height: 100%;
18+
width: 100%;
19+
position: absolute;
20+
grid-area: none;
21+
z-index: -1;
22+
background-image: url(${(props) => props.backgroundUrl});
23+
background-size: cover;
24+
background-repeat: no-repeat;
25+
background-position: center;
26+
`;

src/components/TopBar/ClockMenu/Calendar/Calendar.scss

Whitespace-only changes.

src/components/TopBar/ClockMenu/Calendar/Calendar.tsx

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

src/components/TopBar/ClockMenu/Calendar/index.ts

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

src/components/TopBar/ClockMenu/ClockMenu.tsx

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
1-
import { v4 as uuid } from "uuid";
2-
31
import useDateTime from "../../../hooks/useDateTime";
4-
import useWindowManagerStore from "../../../stores/windowManagerStore";
5-
import BorderedApp from "../../BorderedApp";
6-
7-
import "./ClockMenu.scss";
82

9-
const windowType = "clock";
3+
import { StyledClockMenu, StyledTimeContainer } from "./Styled.ClockMenu";
104

115
interface ClockMenuProps {}
126

137
// eslint-disable-next-line no-empty-pattern
148
function ClockMenu({}: ClockMenuProps) {
15-
const winMan = useWindowManagerStore();
169
const dateTime = useDateTime({
1710
tickFrequency: 1,
1811
tickFrequencyUnit: "minute",
1912
template: "hh:mm",
2013
});
2114

22-
function handleClick() {
23-
const id = uuid();
24-
winMan.addWindow(windowType, id, {
25-
component: BorderedApp,
26-
props: {
27-
title: "Calendar",
28-
initialDimensions: { height: 500, width: 500 },
29-
type: windowType,
30-
id: id,
31-
},
32-
key: id,
33-
});
34-
}
3515
return (
36-
<div id="clock-menu" onClick={() => handleClick()}>
37-
<div id="clock-menu__time-container">
16+
<StyledClockMenu id="clock-menu">
17+
<StyledTimeContainer id="clock-menu__time-container">
3818
<span id="clock-menu__time">{dateTime.formatted}</span>
39-
</div>
40-
</div>
19+
</StyledTimeContainer>
20+
</StyledClockMenu>
4121
);
4222
}
4323

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#clock-menu {
1+
import styled from "@emotion/styled";
2+
3+
export const StyledClockMenu = styled.div`
24
grid-area: clock-menu;
35
width: 100%;
46
height: 100%;
@@ -12,9 +14,8 @@
1214
border-radius: 50px;
1315
transition: ease 0.2s;
1416
}
17+
`;
1518

16-
&__time-container {
17-
padding: 0 10px;
18-
cursor: default;
19-
}
20-
}
19+
export const StyledTimeContainer = styled.div`
20+
padding: 0 10px;
21+
`;

src/components/TopBar/FocusedWindowMenu/FocusedWindowMenu.scss

Whitespace-only changes.

0 commit comments

Comments
 (0)