From d17ba4b8002eb07bcca8fd95db7c888e8ac3c69f Mon Sep 17 00:00:00 2001 From: Iveta Date: Thu, 19 Oct 2023 13:08:28 -0400 Subject: [PATCH] Website: small UI tweaks --- .../design-system-website/src/css/custom.css | 18 +++- .../src/theme/DocCard/index.js | 87 +++++++++++++++++++ .../src/theme/DocCard/styles.module.css | 27 ++++++ 3 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 @stellar/design-system-website/src/theme/DocCard/index.js create mode 100644 @stellar/design-system-website/src/theme/DocCard/styles.module.css diff --git a/@stellar/design-system-website/src/css/custom.css b/@stellar/design-system-website/src/css/custom.css index 79df18bc..ab3b82b7 100644 --- a/@stellar/design-system-website/src/css/custom.css +++ b/@stellar/design-system-website/src/css/custom.css @@ -166,16 +166,16 @@ strong { font-weight: 600; } -p { - font-size: 1rem; -} - p, ul, ol { line-height: 1.6; } +.container { + font-size: 14px; +} + /* Table */ table { display: table; @@ -252,3 +252,13 @@ nav > .menu__list > li > .menu__list-item-collapsible .menu__link { .table-of-contents__link:hover { color: var(--ifm-menu-color-active); } + +/* Cards */ + +.card.padding--lg { + padding: 1rem !important; +} + +.card h2 { + margin-bottom: 0.75rem; +} diff --git a/@stellar/design-system-website/src/theme/DocCard/index.js b/@stellar/design-system-website/src/theme/DocCard/index.js new file mode 100644 index 00000000..57c32e25 --- /dev/null +++ b/@stellar/design-system-website/src/theme/DocCard/index.js @@ -0,0 +1,87 @@ +import React from "react"; +import clsx from "clsx"; +// eslint-disable-next-line import/no-unresolved +import Link from "@docusaurus/Link"; +import { + findFirstCategoryLink, + useDocById, +} from "@docusaurus/theme-common/internal"; +// import isInternalUrl from "@docusaurus/isInternalUrl"; +// eslint-disable-next-line import/no-unresolved +import { translate } from "@docusaurus/Translate"; +import styles from "./styles.module.css"; +function CardContainer({ href, children }) { + return ( + + {children} + + ); +} +function CardLayout({ href, icon, title, description }) { + return ( + +

+ {icon} {title} +

+ {description && ( +

+ {description} +

+ )} +
+ ); +} +function CardCategory({ item }) { + const href = findFirstCategoryLink(item); + // Unexpected: categories that don't have a link have been filtered upfront + if (!href) { + return null; + } + return ( + + ); +} +function CardLink({ item }) { + // const icon = isInternalUrl(item.href) ? '📄️' : '🔗'; + const doc = useDocById(item.docId ?? undefined); + return ( + + ); +} +export default function DocCard({ item }) { + switch (item.type) { + case "link": + return ; + case "category": + return ; + default: + throw new Error(`unknown item type ${JSON.stringify(item)}`); + } +} diff --git a/@stellar/design-system-website/src/theme/DocCard/styles.module.css b/@stellar/design-system-website/src/theme/DocCard/styles.module.css new file mode 100644 index 00000000..4f7ad27f --- /dev/null +++ b/@stellar/design-system-website/src/theme/DocCard/styles.module.css @@ -0,0 +1,27 @@ +.cardContainer { + --ifm-link-color: var(--ifm-color-emphasis-800); + --ifm-link-hover-color: var(--ifm-color-emphasis-700); + --ifm-link-hover-decoration: none; + + box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%); + border: 1px solid var(--ifm-color-emphasis-200); + transition: all var(--ifm-transition-fast) ease; + transition-property: border, box-shadow; +} + +.cardContainer:hover { + border-color: var(--ifm-color-primary); + box-shadow: 0 3px 6px 0 rgb(0 0 0 / 20%); +} + +.cardContainer *:last-child { + margin-bottom: 0; +} + +.cardTitle { + font-size: 1.2rem; +} + +.cardDescription { + font-size: 0.8rem; +}