diff --git a/crates/im-web/assets/main.css b/crates/im-web/assets/main.css index d59b984..57a9e24 100644 --- a/crates/im-web/assets/main.css +++ b/crates/im-web/assets/main.css @@ -319,12 +319,38 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar { padding: 4px 0 10px; } -.service-trio { +.wordmark-family { + position: relative; display: flex; justify-content: center; +} +.wordmark-family .wordmark { + cursor: default; + outline: none; +} +.wordmark-family:hover .service-trio, .wordmark-family:focus-within .service-trio { + opacity: 1; + transform: translate(-50%, 0); + pointer-events: auto; +} + +.service-trio { + position: absolute; + top: 100%; + left: 50%; + z-index: 2; + display: flex; align-items: baseline; gap: 10px; - padding: 0 0 2px; + padding: 6px 12px; + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-2); + opacity: 0; + transform: translate(-50%, -4px); + pointer-events: none; + transition: opacity 120ms ease, transform 120ms ease; } .trio-mark { @@ -338,10 +364,6 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar { .trio-mark:hover { color: var(--ink); } -.trio-mark-on { - color: var(--ink); - box-shadow: inset 0 -2px 0 var(--accent); -} .trio-sep { color: var(--muted-soft); diff --git a/crates/im-web/src/layout.rs b/crates/im-web/src/layout.rs index 76c7ed8..56702b6 100644 --- a/crates/im-web/src/layout.rs +++ b/crates/im-web/src/layout.rs @@ -24,35 +24,36 @@ pub async fn wordmark(cx: &Cx) -> Result { } } -/// The signed-in chrome's app trio: every family service's wordmark, -/// middots between, the home one (`im`) inked and marked current, its -/// siblings plain links. A family with no members renders nothing — the -/// single mark above stays the whole chrome. The list is the stored one, -/// the same rows `/family` serves. -pub async fn service_trio(cx: &Cx) -> Result { +/// The signed-in chrome's wordmark with the family behind it: the `im` +/// mark as above, and the sibling services' wordmarks in a flyout that +/// opens under it on hover and on keyboard focus (the mark is focusable +/// for that), middots between, each a plain link. No script: the flyout +/// is CSS on `:hover` / `:focus-within`. A family with no siblings renders +/// the bare mark — nothing to reveal. The list is the stored one, the same +/// rows `/family` serves, minus im's own row. +pub async fn family_wordmark(cx: &Cx) -> Result { let services = im_core::services::list(&server::app(cx).store).await?; - let marks = (!services.is_empty()).then(|| { - services - .iter() - .map(|service| { - let key = crate::pages::escape(&service.key); - if service.key == "im" { - format!( - r#"{key}"# - ) - } else { - let url = crate::pages::escape(&service.url); - format!(r#"{key}"#) - } - }) - .collect::>() - .join(r#"·"#) - }); + let siblings = services + .iter() + .filter(|service| service.key != "im") + .map(|service| { + let key = crate::pages::escape(&service.key); + let url = crate::pages::escape(&service.url); + format!(r#"{key}"#) + }) + .collect::>(); + if siblings.is_empty() { + return wordmark(cx).await; + } + let marks = siblings.join(r#"·"#); view! { cx => - if let Some(marks) = marks { +
+ + "im" + - } +
} } diff --git a/crates/im-web/src/pages.rs b/crates/im-web/src/pages.rs index 017f853..8722f6c 100644 --- a/crates/im-web/src/pages.rs +++ b/crates/im-web/src/pages.rs @@ -12,7 +12,7 @@ use topcoat::router::{page, path_param, route}; use topcoat::view::view; use crate::i18n::{Key, Lang, lang_of, t}; -use crate::layout::{avatar, service_trio, shell, wordmark}; +use crate::layout::{avatar, family_wordmark, shell, wordmark}; use crate::server::{self, PendingPurpose}; path_param!(token); @@ -602,15 +602,14 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { ) }) .collect::(); - // The family lives in the chrome — the wordmark trio under the + // The family lives in the chrome — the siblings' flyout under the // wordmark — and its editing in the admin panel; the landing is the // account's own page and carries no directory of its own. let stage = view! { cx =>
- (wordmark(cx).await?) - (service_trio(cx).await?) + (family_wordmark(cx).await?) if let Some(code) = ok {
(ok_text(&code, lang))
diff --git a/crates/im-web/src/people.rs b/crates/im-web/src/people.rs index 6d9f81b..0cfa099 100644 --- a/crates/im-web/src/people.rs +++ b/crates/im-web/src/people.rs @@ -14,7 +14,7 @@ use topcoat::view::view; use im_core::accounts; use crate::i18n::{Key, lang_of, t}; -use crate::layout::{avatar, service_trio, shell, wordmark}; +use crate::layout::{avatar, family_wordmark, shell}; use crate::server; path_param!(user_id); @@ -39,8 +39,7 @@ async fn people_page(cx: &Cx) -> Result { cx =>
- (wordmark(cx).await?) - (service_trio(cx).await?) + (family_wordmark(cx).await?)
if person.has_photo { diff --git a/style/main.scss b/style/main.scss index 5ba4ea7..ea6e974 100644 --- a/style/main.scss +++ b/style/main.scss @@ -279,15 +279,45 @@ body:has(.auth-stage) { padding: 4px 0 10px; } -// The app trio under the signed-in wordmark: lower-case marks in the -// wordmark's mono, the home one inked, its siblings quiet links. The -// middots are part of the mark, not decoration between cards. -.service-trio { +// The family behind the signed-in wordmark: the siblings' marks in the +// wordmark's mono, middots between, in a flyout that hangs under the mark +// and shows on hover or keyboard focus (the mark carries tabindex for it). +// Absolutely placed so the chrome keeps the bare wordmark's height; it +// stays in the DOM so the links are reachable by tab, which is what opens +// it for a keyboard. No gap between mark and flyout, so the pointer can +// travel down into it without it closing. +.wordmark-family { + position: relative; display: flex; justify-content: center; + + .wordmark { cursor: default; outline: none; } + + &:hover .service-trio, + &:focus-within .service-trio { + opacity: 1; + transform: translate(-50%, 0); + pointer-events: auto; + } +} + +.service-trio { + position: absolute; + top: 100%; + left: 50%; + z-index: 2; + display: flex; align-items: baseline; gap: 10px; - padding: 0 0 2px; + padding: 6px 12px; + background: var(--surface); + border: 1px solid var(--border); + border-radius: var(--radius); + box-shadow: var(--shadow-2); + opacity: 0; + transform: translate(-50%, -4px); + pointer-events: none; + transition: opacity 120ms ease, transform 120ms ease; } .trio-mark { @@ -299,11 +329,6 @@ body:has(.auth-stage) { color: var(--muted); &:hover { color: var(--ink); } - - &-on { - color: var(--ink); - box-shadow: inset 0 -2px 0 var(--accent); - } } .trio-sep { color: var(--muted-soft); }