Skip to content

Commit c505a3a

Browse files
Better looking buttons on custom titlebar
1 parent 740438b commit c505a3a

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

app/components/TitleBar.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"use client";
22

33
import { getCurrentWindow } from "@tauri-apps/api/window";
4-
import Button from "@/components/Button";
54
import { useEffect, useState } from "react";
65
import { Stack } from "react-bootstrap";
76
import { getUseCustomTitlebar } from "@/app/util";
@@ -21,6 +20,14 @@ const onClickMaximize = async () => {
2120

2221
const onClickMinimize = () => getCurrentWindow().minimize();
2322

23+
function TitleBarButton({ icon, onClick }: { icon: string; onClick: () => Promise<void> }) {
24+
return (
25+
<div className="titlebar-button" onClick={onClick}>
26+
<i className={"fa-solid fa-" + icon}></i>
27+
</div>
28+
)
29+
}
30+
2431
export default function TitleBar() {
2532
const [show, setShow] = useState<boolean>(false);
2633
const [appName, setAppName] = useState<string>("");
@@ -39,22 +46,16 @@ export default function TitleBar() {
3946
<div className="titlebar">
4047
<span data-tauri-drag-region>{appName}</span>
4148
<Stack direction="horizontal" className="flex-row-reverse" gap={1}>
42-
<Button
43-
variant="danger"
49+
<TitleBarButton
4450
icon="x"
45-
iconStyle="solid"
4651
onClick={onClickClose}
4752
/>
48-
<Button
49-
variant="primary"
53+
<TitleBarButton
5054
icon="window-maximize"
51-
iconStyle="solid"
5255
onClick={onClickMaximize}
5356
/>
54-
<Button
55-
variant="primary"
57+
<TitleBarButton
5658
icon="window-minimize"
57-
iconStyle="solid"
5859
onClick={onClickMinimize}
5960
/>
6061
</Stack>

app/css/openfusion-layout.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ body {
1616
overflow-x: hidden;
1717
}
1818

19-
.titlebar button {
19+
.titlebar-button {
2020
width: 30px;
2121
height: 30px;
2222
padding: 1px !important;
2323
z-index: 3001;
24+
display: flex;
25+
align-items: center;
26+
justify-content: center;
2427
}
2528

2629
.titlebar span {

app/css/openfusion-theming.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ $title-bar-bg-opacity: 0.05;
1919
background-color: rgba($body-bg, $title-bar-bg-opacity)
2020
}
2121

22+
.titlebar-button:hover {
23+
background-color: rgba($body-bg, $title-bar-bg-opacity * 2);
24+
}
25+
2226
.table-striped thead th {
2327
background-color: #34476e;
2428
}
@@ -171,6 +175,10 @@ $title-bar-bg-opacity: 0.05;
171175
background-color: rgba($body-bg-dark, $title-bar-bg-opacity)
172176
}
173177

178+
.titlebar-button:hover {
179+
background-color: rgba($body-bg-dark, $title-bar-bg-opacity * 2);
180+
}
181+
174182
.table-striped thead th {
175183
background-color: #0099d8;
176184
}
@@ -318,6 +326,10 @@ $title-bar-bg-opacity: 0.05;
318326
background-color: $body-bg-dark;
319327
}
320328

329+
.titlebar-button {
330+
border-radius: 100%;
331+
}
332+
321333
.btn {
322334
color: $light !important;
323335
font-size: 12pt;

0 commit comments

Comments
 (0)