feat(ui): new Archie mark, shared sage accent, theme follows the OS (#1858)
This commit is contained in:
19 files changed
+256
-175
No files matched your search
@@ -1,19 +1,34 @@
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import Logo from "./Logo.vue";
|
||||
import BrandName from "./BrandName.vue";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { useAccountsStore } from "@/accounts/accounts";
|
||||
|
||||
const accounts = useAccountsStore();
|
||||
|
||||
// The name shows briefly on load, then folds to the mark until hovered or
|
||||
// focused, so the topbar keeps its room for navigation.
|
||||
const hovered = ref(false);
|
||||
const intro = ref(false);
|
||||
let fold: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
onMounted(() => {
|
||||
intro.value = true;
|
||||
fold = setTimeout(() => (intro.value = false), 3000);
|
||||
});
|
||||
onBeforeUnmount(() => clearTimeout(fold));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterLink
|
||||
to="/"
|
||||
class="flex items-center gap-2 rounded-md px-1 py-1 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
||||
@mouseenter="hovered = true"
|
||||
@mouseleave="hovered = false"
|
||||
@focus="hovered = true"
|
||||
@blur="hovered = false"
|
||||
>
|
||||
<Logo />
|
||||
<BrandName class="hidden sm:inline" />
|
||||
<Logo :open="intro || hovered" cycle />
|
||||
<Badge v-if="accounts.instance" variant="info">{{ accounts.instance }}</Badge>
|
||||
</RouterLink>
|
||||
</template>
|
||||
@@ -1,3 +0,0 @@
|
||||
<template>
|
||||
<span class="text-title font-semibold tracking-tight">Archie</span>
|
||||
</template>
|
||||
@@ -1,22 +1,71 @@
|
||||
<script setup lang="ts">
|
||||
withDefaults(defineProps<{ size?: number }>(), { size: 22 });
|
||||
import { nextTick, onBeforeUnmount, ref, watch } from "vue";
|
||||
|
||||
/**
|
||||
* The mark stands in for the A of the name. Closed, only the mark shows; open,
|
||||
* the rest of the name slides out from behind it and, with `cycle`, steps
|
||||
* through the product family.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{ open?: boolean; cycle?: boolean }>(), {
|
||||
open: true,
|
||||
cycle: false,
|
||||
});
|
||||
|
||||
const NAMES = ["rchie", "rchitect", "rchimedes", "rchipelago"];
|
||||
|
||||
const index = ref(0);
|
||||
const swapping = ref(false);
|
||||
const width = ref("0px");
|
||||
const text = ref<HTMLElement>();
|
||||
let timer: ReturnType<typeof setInterval> | undefined;
|
||||
|
||||
async function fit(): Promise<void> {
|
||||
await nextTick();
|
||||
width.value = props.open && text.value ? `${Math.ceil(text.value.getBoundingClientRect().width)}px` : "0px";
|
||||
}
|
||||
|
||||
function next(): void {
|
||||
swapping.value = true;
|
||||
setTimeout(() => {
|
||||
index.value = (index.value + 1) % NAMES.length;
|
||||
swapping.value = false;
|
||||
void fit();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.open,
|
||||
(open) => {
|
||||
clearInterval(timer);
|
||||
if (open && props.cycle) timer = setInterval(next, 1800);
|
||||
// Reset to Archie once the name has folded away, not while it is visible.
|
||||
if (!open) setTimeout(() => !props.open && (index.value = 0), 460);
|
||||
void fit();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
onBeforeUnmount(() => clearInterval(timer));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<svg
|
||||
:width="size"
|
||||
:height="size"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
class="text-link shrink-0"
|
||||
>
|
||||
<path d="M12 2.5 21 20h-4.1L12 10.6 7.1 20H3l9-17.5Z" fill="currentColor" />
|
||||
<path
|
||||
d="M8.6 16.2h6.8"
|
||||
stroke="var(--background)"
|
||||
stroke-width="1.6"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
</svg>
|
||||
<span class="text-foreground inline-flex items-baseline text-title leading-none font-semibold tracking-tight whitespace-nowrap">
|
||||
<svg viewBox="2 3 20 18" aria-hidden="true" class="h-[0.698em] w-[0.776em] shrink-0 self-baseline overflow-visible">
|
||||
<path d="M2 21h4l8-18h-4z" fill="currentColor" />
|
||||
<path d="M14.9 5.03 22 21h-4l-5.1-11.47z" fill="currentColor" />
|
||||
<path d="M10.47 15h3.06l1.11 2.5H9.36z" class="fill-brand" />
|
||||
</svg>
|
||||
<span class="sr-only">Archie</span>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="-mb-[0.25em] inline-block overflow-hidden pb-[0.25em] transition-[max-width] duration-[460ms] ease-[cubic-bezier(0.2,0.7,0.2,1)]"
|
||||
:style="{ maxWidth: width }"
|
||||
>
|
||||
<span
|
||||
ref="text"
|
||||
class="inline-block w-max pl-[0.02em] transition-[opacity,translate] duration-200"
|
||||
:class="swapping && 'translate-y-[0.18em] opacity-0'"
|
||||
>{{ NAMES[index] }}</span
|
||||
>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
@@ -6,7 +6,6 @@ import { Building2, LayoutDashboard, ListChecks, Menu, Server, Workflow, Zap, ty
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet";
|
||||
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
|
||||
import BrandName from "./BrandName.vue";
|
||||
import Logo from "./Logo.vue";
|
||||
|
||||
/** The section list at phone width, where the strip has no room to show a
|
||||
@@ -48,7 +47,7 @@ watch(() => route.path, () => (open.value = false));
|
||||
</SheetTrigger>
|
||||
<SheetContent @close-auto-focus="onCloseAutoFocus" side="left" class="w-64 gap-0 p-0">
|
||||
<SheetHeader class="border-b px-4 py-3">
|
||||
<SheetTitle class="flex items-center gap-2"><Logo /><BrandName /></SheetTitle>
|
||||
<SheetTitle class="flex items-center"><Logo /></SheetTitle>
|
||||
</SheetHeader>
|
||||
<nav aria-label="Sections" class="flex flex-col gap-0.5 p-2">
|
||||
<RouterLink
|
||||
|
||||
@@ -17,7 +17,7 @@ export const badgeVariants = cva(
|
||||
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
||||
ghost:
|
||||
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
link: "text-link underline-offset-4 hover:underline",
|
||||
// Status. The five semantic kinds the dashboard's pills used, and the
|
||||
// only place status colour is decided: a task state, a gate result, a
|
||||
// log level and a trend all draw from the same ramp, so the same
|
||||
|
||||
@@ -17,7 +17,7 @@ export const buttonVariants = cva(
|
||||
"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",
|
||||
destructive:
|
||||
"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
link: "text-link underline-offset-4 hover:underline",
|
||||
// An action that exists because something needs attention has to look
|
||||
// unlike one that is always present. `destructive` would overstate it:
|
||||
// nothing is broken, it is waiting.
|
||||
|
||||
@@ -11,7 +11,7 @@ const props = defineProps<{
|
||||
<p
|
||||
data-slot="item-description"
|
||||
:class="cn(
|
||||
'text-muted-foreground text-left text-sm leading-normal group-data-[size=xs]/item:text-xs line-clamp-2 font-normal [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',
|
||||
'text-muted-foreground text-left text-sm leading-normal group-data-[size=xs]/item:text-xs line-clamp-2 font-normal [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-link',
|
||||
props.class,
|
||||
)"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user