cobalt/web/src/routes/+layout.svelte

241 lines
5.7 KiB
Svelte
Raw Normal View History

2024-06-14 11:33:01 +01:00
<script>
import "@fontsource/ibm-plex-mono/400.css";
import "@fontsource/ibm-plex-mono/500.css";
import Sidebar from "$components/sidebar/Sidebar.svelte";
2024-06-14 11:33:01 +01:00
</script>
<div id="cobalt">
<Sidebar />
<div id="content">
<slot></slot>
</div>
</div>
<style>
:global(:root) {
2024-06-14 16:48:57 +01:00
--primary: #ffffff;
--secondary: #000000;
--white: #ffffff;
2024-06-14 16:48:57 +01:00
--gray: #8d8d95;
--blue: #2f8af9;
--green: #51cf5e;
2024-06-14 16:48:57 +01:00
--button: #f4f4f4;
--button-hover: #e8e8e8;
--button-hover-transparent: rgba(0, 0, 0, 0.06);
--button-stroke: rgba(0, 0, 0, 0.08);
2024-06-17 13:46:52 +01:00
--button-text: #282828;
2024-06-14 16:48:57 +01:00
--sidebar-bg: #000000;
--sidebar-highlight: #ffffff;
--input-border: #8d8d95;
2024-06-14 16:48:57 +01:00
--padding: 12px;
--border-radius: 11px;
2024-06-14 16:48:57 +01:00
2024-06-14 11:33:01 +01:00
--sidebar-width: 80px;
--sidebar-height-mobile: calc(52px + env(safe-area-inset-bottom));
2024-06-14 11:33:01 +01:00
--sidebar-font-size: 11px;
--sidebar-inner-padding: 4px;
--sidebar-mobile-gradient: linear-gradient(
90deg,
rgba(0, 0, 0, 0.9) 0%,
rgba(0, 0, 0, 0) 4%,
rgba(0, 0, 0, 0) 50%,
rgba(0, 0, 0, 0) 96%,
rgba(0, 0, 0, 0.9) 100%
);
}
/* temporary switcher until theming is implemented, */
/* just so my eyes don't burn at night */
@media (prefers-color-scheme: dark) {
:global(:root) {
--primary: #000000;
--secondary: #e1e1e1;
--gray: #6e6e6e;
--blue: #2a7ce1;
--green: #37aa42;
--button: #191919;
--button-hover: #2a2a2a;
--button-hover-transparent: rgba(225, 225, 225, 0.1);
--button-stroke: rgba(255, 255, 255, 0.08);
2024-06-17 13:46:52 +01:00
--button-text: #e1e1e1;
--sidebar-bg: #101010;
--sidebar-highlight: #f2f2f2;
--input-border: #383838;
--sidebar-mobile-gradient: linear-gradient(
90deg,
rgba(16, 16, 16, 0.9) 0%,
rgba(16, 16, 16, 0) 4%,
rgba(16, 16, 16, 0) 50%,
rgba(16, 16, 16, 0) 96%,
rgba(16, 16, 16, 0.9) 100%
);
}
2024-06-14 11:33:01 +01:00
}
2024-06-14 11:38:10 +01:00
2024-06-14 11:33:01 +01:00
:global(html),
:global(body) {
margin: 0;
background-color: var(--sidebar-bg);
color: var(--secondary);
2024-06-14 16:48:57 +01:00
}
:global(*) {
font-family: "IBM Plex Mono", "Noto Sans Mono Variable", "Noto Sans Mono", monospace;
user-select: none;
2024-06-16 14:25:30 +01:00
scrollbar-width: none;
-webkit-user-select: none;
2024-06-14 16:48:57 +01:00
-webkit-user-drag: none;
2024-06-16 14:25:30 +01:00
-webkit-tap-highlight-color: transparent;
}
:global(::-webkit-scrollbar) {
display: none;
2024-06-14 11:33:01 +01:00
}
2024-06-14 11:38:10 +01:00
2024-06-14 11:33:01 +01:00
:global(a) {
text-decoration: none;
text-decoration-line: none;
-webkit-touch-callout: none;
2024-06-14 11:33:01 +01:00
}
2024-06-14 11:38:10 +01:00
2024-06-14 16:48:57 +01:00
:global(svg),
:global(img) {
pointer-events: none;
}
:global(button) {
display: flex;
align-items: center;
justify-content: center;
2024-06-17 13:46:21 +01:00
padding: 6px 13px;
gap: 6px;
2024-06-14 16:48:57 +01:00
border: none;
border-radius: var(--border-radius);
2024-06-17 13:46:21 +01:00
font-size: 14.5px;
2024-06-14 16:48:57 +01:00
cursor: pointer;
background-color: var(--button);
2024-06-17 13:46:52 +01:00
color: var(--button-text);
box-shadow: 0 0 0 1.5px var(--button-stroke) inset;
}
2024-06-24 18:22:19 +01:00
:global(:focus-visible) {
box-shadow: 0 0 0 2px var(--blue) inset;
outline: none;
z-index: 1;
}
:global(button:active) {
transform: scale(0.95);
2024-06-14 16:48:57 +01:00
}
:global(.button.active) {
background: var(--secondary);
color: var(--primary);
}
2024-06-24 18:22:19 +01:00
/* important is used because active class is toggled by state */
/* and added to the end of the list, taking priority */
:global(.active:focus-visible) {
background: var(--blue) !important;
color: var(--sidebar-highlight) !important;
}
@media (hover: hover) {
:global(button:hover) {
background-color: var(--button-hover);
}
2024-06-14 16:48:57 +01:00
}
:global(.center-column-container) {
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
}
:global(button) {
2024-06-24 15:26:45 +01:00
font-weight: 500;
}
:global(h1, h2, h3, h4, h5, h6) {
font-weight: 500;
margin-block: 0;
}
:global(h1) {
font-size: 24px;
letter-spacing: -1px;
}
:global(h2) {
font-size: 20px;
letter-spacing: -1px;
}
:global(h3) {
font-size: 16px;
}
:global(h4) {
font-size: 14.5px;
}
:global(h5) {
2024-06-24 15:26:45 +01:00
font-size: 12px;
}
:global(h6) {
font-size: 11px;
}
2024-06-24 15:26:45 +01:00
:global(.subtext) {
font-size: 13px;
color: var(--gray);
line-height: 1.4;
}
2024-06-14 11:33:01 +01:00
#cobalt {
height: 100vh;
display: grid;
grid-template-columns: calc(var(--sidebar-width) + 8px) 1fr;
2024-06-14 11:33:01 +01:00
overflow: hidden;
}
2024-06-14 11:38:10 +01:00
2024-06-14 11:33:01 +01:00
#content {
display: flex;
overflow: scroll;
2024-06-16 15:15:17 +01:00
padding: var(--padding);
background-color: var(--primary);
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
2024-06-14 11:33:01 +01:00
}
2024-06-16 14:25:30 +01:00
2024-06-14 12:33:33 +01:00
@media screen and (max-width: 535px) {
#cobalt {
display: grid;
grid-template-columns: unset;
grid-template-rows: 1fr calc(var(--sidebar-height-mobile) + 8px);
2024-06-14 12:33:33 +01:00
}
#content {
padding-top: env(safe-area-inset-top);
2024-06-14 12:33:33 +01:00
order: -1;
border-top-left-radius: 0;
border-bottom-left-radius: calc(var(--border-radius) * 2);
border-bottom-right-radius: calc(var(--border-radius) * 2);
2024-06-14 12:33:33 +01:00
}
}
2024-06-14 11:33:01 +01:00
</style>