Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(website): replace note-type/collection grids with tabbed showcase
Elian Doranbee00a675a91
diff --git a/apps/website/src/pages/Home/index.css b/apps/website/src/pages/Home/index.cssindex 048dff393b..feb1e0fc2c 100644--- a/apps/website/src/pages/Home/index.css+++ b/apps/website/src/pages/Home/index.css@@ -170,7 +170,7 @@ section.ai-integration .ai-cards {gap: 1em;}-section.ai-integration .ai-integration-cta {+.section-cta {margin-top: 2.5em;display: flex;justify-content: center;@@ -209,16 +209,6 @@ section.import .import-export-note {color: var(--muted-color);}-section.import .import-cta {- margin-top: 1.5em;- display: flex;- justify-content: center;-- .button {- padding: 0.75em 2em;- }-}-section.final-cta {text-align: center;padding: 6em 0;@@ -253,50 +243,147 @@ section.faq {}}-.list-with-screenshot {- gap: 2em;+.tabbed-showcase {+ display: grid;+ gap: 1.5em;+ align-items: start;@media (min-width: 720px) {- display: flex;+ grid-template-columns: minmax(210px, 1fr) 2.3fr;+ gap: 2.5em;}+}- h3 {- color: var(--brand-1);+.tabbed-showcase .showcase-tabs {+ list-style: none;+ margin: 0;+ padding: 0;+ display: flex;+ gap: 0.5em;+ /* Mobile: horizontally scrollable chips */+ overflow-x: auto;+ scrollbar-width: none;++ &::-webkit-scrollbar {+ display: none;}- ul {- list-style-type: none;+ @media (min-width: 720px) {+ flex-direction: column;+ overflow: visible;+ }++ li {margin: 0;- padding: 0;- gap: 1em;- display: grid;+ }+}- @media (min-width: 720px) {- grid-template-columns: 1fr 1fr 1fr;- }+.tabbed-showcase .showcase-tab {+ display: inline-flex;+ align-items: center;+ gap: 0.7em;+ width: auto;+ white-space: nowrap;+ cursor: pointer;+ border: 1px solid transparent;+ border-radius: 12px;+ background: transparent;+ color: var(--muted-color);+ font: inherit;+ padding: 0.7em 0.9em;+ text-align: left;+ transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;- li {- margin: 0;+ @media (min-width: 720px) {+ width: 100%;+ }- .card {- border: 1px solid transparent;- height: 100%;- }- }+ .tab-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+ width: 2em;+ height: 2em;+ border-radius: 9px;+ color: var(--brand-1);+ background: color-mix(in srgb, var(--brand-1) 12%, transparent);+ transition: background-color 0.18s ease, color 0.18s ease;}- .details {- max-height: 35vh;- overflow: hidden;- display: flex;- flex-direction: column;+ &:hover {+ color: var(--foreground-color);+ border-color: color-mix(in srgb, var(--brand-1) 25%, transparent);+ }++ &.active {+ color: var(--foreground-color);+ background: var(--card-background-color);+ border-color: color-mix(in srgb, var(--brand-1) 35%, transparent);+ box-shadow: var(--card-box-shadow);- @media (max-width: 719.99px) {- margin-top: 1em;+ .tab-icon {+ color: var(--brand-foreground-color);+ background: var(--brand-1);}}+}++.tabbed-showcase .showcase-preview {+ display: flex;+ flex-direction: column;+ gap: 1.2em;+ min-width: 0;++ @media (prefers-reduced-motion: no-preference) {+ animation: showcase-fade 0.15s ease;+ }+}++.tabbed-showcase .showcase-image-frame {+ /* Fixed aspect ratio keeps the frame a constant height across screenshots,+ so swapping tabs never shifts the layout. Off-ratio images are matted+ against the card background rather than cropped. */+ aspect-ratio: 16 / 10;+ border-radius: 16px;+ overflow: hidden;+ background: var(--card-background-color);+ box-shadow: var(--card-box-shadow);+ border: 1px solid color-mix(in srgb, var(--brand-1) 15%, transparent);img {+ display: block;+ width: 100%;+ height: 100%;object-fit: contain;}}++.tabbed-showcase .showcase-details {+ color: var(--muted-color);++ h3 {+ margin: 0 0 0.4em;+ color: var(--brand-1);+ font-weight: 300;+ font-size: 1.3rem;+ }++ p {+ margin: 0 0 0.6em;+ }++ .more-info {+ font-size: 0.9em;+ }+}++@keyframes showcase-fade {+ from {+ opacity: 0;+ }++ to {+ opacity: 1;+ }+}diff --git a/apps/website/src/pages/Home/index.tsx b/apps/website/src/pages/Home/index.tsxindex 96f8f214ed..4b89bba5d9 100644--- a/apps/website/src/pages/Home/index.tsx+++ b/apps/website/src/pages/Home/index.tsx@@ -42,6 +42,7 @@ import oneNoteIcon from "../../assets/import/onenote.svg?raw";import Button, { Link } from '../../components/Button.js';import Card from '../../components/Card.js';import DownloadButton from '../../components/DownloadButton.js';+import Icon from '../../components/Icon.js';import Section from '../../components/Section.js';import { getPlatform } from '../../download-helper.js';import { useColorScheme, usePageTitle } from '../../hooks.js';@@ -147,7 +148,7 @@ function NoteTypesSection() {const { t } = useTranslation();return (<Section className="note-types" title={t("note_types.title")}>- <ListWithScreenshot items={[+ <TabbedShowcase items={[{title: t("note_types.text_title"),imageUrl: "/type_text.webp",@@ -240,7 +241,7 @@ function CollectionsSection() {const { t } = useTranslation();return (<Section className="collections accented" title={t("collections.title")} subtitle={t("collections.subtitle")}>- <ListWithScreenshot items={[+ <TabbedShowcase items={[{title: t("collections.calendar_title"),imageUrl: "/collection_calendar.webp",@@ -309,7 +310,7 @@ function AiIntegrationSection() {function ImportSection() {const { t } = useTranslation();return (- <Section className="benefits import" title={t("import.title")} subtitle={t("import.subtitle")}>+ <Section className="benefits import" title={t("import.title")} subtitle={t("import.subtitle")} cta={{ text: t("import.learn_more"), href: "https://docs.triliumnotes.org/user-guide/concepts/import-export" }}><div className="benefits-container grid-3-cols"><Card iconSvg={oneNoteIcon} title={t("import.onenote_title")}>{t("import.onenote_description")}</Card><Card iconSvg={notionIcon} title={t("import.notion_title")}>{t("import.notion_description")}</Card>@@ -320,34 +321,57 @@ function ImportSection() {</div><p className="import-export-note">{t("import.export_note")}</p>-- <div className="import-cta">- <Button outline text={t("import.learn_more")} href="https://docs.triliumnotes.org/user-guide/concepts/import-export" openExternally />- </div></Section>);}-function ListWithScreenshot({ items, cardExtra }: {- items: { title: string, imageUrl: string, description: string, moreInfo: string, iconSvg?: string }[];- cardExtra?: ComponentChildren;-}) {+interface ShowcaseItem {+ title: string;+ imageUrl: string;+ description: string;+ moreInfo: string;+ iconSvg?: string;+}++function TabbedShowcase({ items }: { items: ShowcaseItem[] }) {+ const { t } = useTranslation();+ const [ activeIndex, setActiveIndex ] = useState(0);+ const active = items[activeIndex];+return (- <div className={`list-with-screenshot`}>- <ul>- {items.map(item => (- <li>- <Card- title={item.title}- moreInfoUrl={item.moreInfo}- iconSvg={item.iconSvg}- imageUrl={item.imageUrl}- >- {item.description}- </Card>- </li>- ))}+ <div className="tabbed-showcase">+ <ul className="showcase-tabs" role="tablist">+ {items.map((item, index) => {+ const isActive = index === activeIndex;+ return (+ <li role="presentation" key={item.title}>+ <button+ type="button"+ role="tab"+ aria-selected={isActive}+ className={`showcase-tab ${isActive ? "active" : ""}`}+ onClick={() => setActiveIndex(index)}+ onMouseEnter={() => setActiveIndex(index)}+ onFocus={() => setActiveIndex(index)}+ >+ {item.iconSvg && <span className="tab-icon"><Icon svg={item.iconSvg} /></span>}+ <span className="tab-label">{item.title}</span>+ </button>+ </li>+ );+ })}</ul>++ <div className="showcase-preview" key={activeIndex} role="tabpanel">+ <div className="showcase-image-frame">+ <img src={active.imageUrl} alt={active.title} loading="lazy" />+ </div>+ <div className="showcase-details">+ <h3>{active.title}</h3>+ <p>{active.description}</p>+ <Link href={active.moreInfo} className="more-info" openExternally>{t("components.link_learn_more")}</Link>+ </div>+ </div></div>);}