From 4ae0dc6935c9fd5ae92303c60b9117cccad38e38 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 1 Aug 2021 16:44:51 +0100 Subject: [PATCH] Improve titlebar design. --- src/components/native/Titlebar.tsx | 37 +++++++++++++++++++++--------- src/pages/RevoltApp.tsx | 4 ++-- src/styles/_variables.scss | 22 ++++++++++++++---- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/components/native/Titlebar.tsx b/src/components/native/Titlebar.tsx index 14a5c476..c4ec0a67 100644 --- a/src/components/native/Titlebar.tsx +++ b/src/components/native/Titlebar.tsx @@ -1,13 +1,10 @@ -import { X, Minus, Square } from "@styled-icons/boxicons-regular"; +import { X, Minus, Square, Wrench } from "@styled-icons/boxicons-regular"; import styled from "styled-components"; -import wideSVG from "../../assets/wide.svg"; - -export const TITLEBAR_HEIGHT = "24px"; export const USE_TITLEBAR = window.isNative && !window.native.getConfig().frame; const TitlebarBase = styled.div` - height: ${TITLEBAR_HEIGHT}; + height: var(--titlebar-height); display: flex; user-select: none; @@ -19,10 +16,15 @@ const TitlebarBase = styled.div` font-size: 16px; font-weight: 600; - margin-left: 4px; + margin-left: 8px; - img { - width: 60px; + gap: 8px; + display: flex; + align-items: center; + justify-content: flex-start; + + svg { + height: calc(var(--titlebar-height) / 2); } } @@ -32,8 +34,10 @@ const TitlebarBase = styled.div` align-items: center; div { - width: 24px; - height: 24px; + width: calc( + var(--titlebar-height) + var(--titlebar-action-padding) + ); + height: var(--titlebar-height); display: grid; place-items: center; @@ -54,7 +58,18 @@ export function Titlebar() { return ( - + + + + {window.native.getConfig().build === "dev" && }
diff --git a/src/pages/RevoltApp.tsx b/src/pages/RevoltApp.tsx index 4af34dbd..019cb90a 100644 --- a/src/pages/RevoltApp.tsx +++ b/src/pages/RevoltApp.tsx @@ -10,7 +10,7 @@ import Notifications from "../context/revoltjs/Notifications"; import StateMonitor from "../context/revoltjs/StateMonitor"; import SyncManager from "../context/revoltjs/SyncManager"; -import { TITLEBAR_HEIGHT, USE_TITLEBAR } from "../components/native/Titlebar"; +import { USE_TITLEBAR } from "../components/native/Titlebar"; import BottomNavigation from "../components/navigation/BottomNavigation"; import LeftSidebar from "../components/navigation/LeftSidebar"; import RightSidebar from "../components/navigation/RightSidebar"; @@ -48,7 +48,7 @@ export default function App() { width="100vw" height={ USE_TITLEBAR - ? `calc(var(--app-height) - ${TITLEBAR_HEIGHT})` + ? "calc(var(--app-height) - var(--titlebar-height))" : "var(--app-height)" } leftPanel={ diff --git a/src/styles/_variables.scss b/src/styles/_variables.scss index 4966a490..b6812a07 100644 --- a/src/styles/_variables.scss +++ b/src/styles/_variables.scss @@ -7,13 +7,20 @@ --font: "Open Sans"; --codeblock-font: "Fira Code"; --sidebar-active: var(--secondary-background); - + + /** + * Native + */ + --titlebar-height: 29px; + --titlebar-action-padding: 8px; + --titlebar-logo-color: var(--secondary-foreground); + /** * Layout */ --app-height: 100vh; --border-radius: 6px; - + --input-border-width: 2px; --textarea-padding: 16px; --textarea-line-height: 20px; @@ -29,6 +36,13 @@ /** * Experimental */ - --background-rgb: (25,25,25); //THIS IS SO THAT WE CAN HAVE CUSTOM BACKGROUNDS FOR THE CLIENT, CONVERTS THE HEX TO AN RGB VALUE FROM --background - --background-rgba: rgba(var(--background-rgb), .8); //make the opacity also customizable + --background-rgb: ( + 25, + 25, + 25 + ); //THIS IS SO THAT WE CAN HAVE CUSTOM BACKGROUNDS FOR THE CLIENT, CONVERTS THE HEX TO AN RGB VALUE FROM --background + --background-rgba: rgba( + var(--background-rgb), + 0.8 + ); //make the opacity also customizable }