merge: retain concurrent official docs visual corrections
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { Card, CardTitle, CardDescription } from "@heroui-vue/components";
|
||||
import { computed, ref } from "vue";
|
||||
import { Card, Link } from "@heroui-vue/components";
|
||||
import { withBase } from "vitepress";
|
||||
import { IconArrowUpRight } from "@tabler/icons-vue";
|
||||
import { searchIndex } from "virtual:docs-data";
|
||||
import { componentItems } from "./navigation";
|
||||
const props = defineProps<{ category: string }>();
|
||||
const items = computed(() =>
|
||||
componentItems.filter((item) => item.category === props.category),
|
||||
);
|
||||
const failed = ref(new Set<string>());
|
||||
function imageName(title: string) {
|
||||
return title.split(" ")[0].toLowerCase();
|
||||
}
|
||||
function thumbnail(title: string, theme: "light" | "dark") {
|
||||
return `https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/related-components/${theme}-${imageName(title)}.png`;
|
||||
}
|
||||
function description(url: string) {
|
||||
return (
|
||||
searchIndex.find((entry) => entry.url === url && entry.section === "概览")
|
||||
@@ -21,16 +27,36 @@ function description(url: string) {
|
||||
<Card
|
||||
v-for="item in items"
|
||||
:key="item.url"
|
||||
as="a"
|
||||
:href="withBase(item.url)"
|
||||
class="component-index-card"
|
||||
variant="transparent"
|
||||
>
|
||||
<CardTitle>
|
||||
<div class="component-index-preview" aria-hidden="true">
|
||||
<template v-for="theme in ['light', 'dark'] as const" :key="theme">
|
||||
<img
|
||||
v-if="!failed.has(theme + item.url)"
|
||||
:class="'component-thumbnail-' + theme"
|
||||
:src="thumbnail(item.title, theme)"
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width="874"
|
||||
height="594"
|
||||
@error="failed.add(theme + item.url)"
|
||||
/>
|
||||
<div
|
||||
v-else
|
||||
:class="
|
||||
'component-thumbnail-' + theme + ' component-thumbnail-fallback'
|
||||
"
|
||||
>
|
||||
<strong>{{ item.title.split(" ")[0] }}</strong>
|
||||
<span>{{ description(item.url) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<Link :href="withBase(item.url)" class="component-index-title">
|
||||
{{ item.title }}
|
||||
<IconArrowUpRight aria-hidden="true" :size="16" />
|
||||
</CardTitle>
|
||||
<CardDescription>{{ description(item.url) }}</CardDescription>
|
||||
</Link>
|
||||
</Card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -19,8 +19,6 @@ import {
|
||||
Link,
|
||||
Chip,
|
||||
Separator,
|
||||
Breadcrumbs,
|
||||
BreadcrumbsItem,
|
||||
Card,
|
||||
Drawer,
|
||||
DrawerTrigger,
|
||||
@@ -379,20 +377,6 @@ async function copyMarkdownCode(event: MouseEvent) {
|
||||
</Popover>
|
||||
</div>
|
||||
<main id="main" class="docs-main" tabindex="-1">
|
||||
<nav aria-label="面包屑">
|
||||
<Breadcrumbs class="breadcrumb" aria-label="页面路径">
|
||||
<BreadcrumbsItem
|
||||
:href="
|
||||
withBase(
|
||||
section === 'components' ? '/components' : '/introduction',
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ section === "components" ? "组件" : "快速开始" }}
|
||||
</BreadcrumbsItem>
|
||||
<BreadcrumbsItem>{{ frontmatter.title }}</BreadcrumbsItem>
|
||||
</Breadcrumbs>
|
||||
</nav>
|
||||
<h1 tabindex="-1">{{ frontmatter.title }}</h1>
|
||||
<p v-if="frontmatter.description" class="page-description">
|
||||
{{ frontmatter.description }}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
--docs-width: 1400px;
|
||||
--docs-header-height: 96px;
|
||||
--docs-sidebar-width: 220px;
|
||||
--docs-toc-width: 240px;
|
||||
--docs-toc-width: 268px;
|
||||
}
|
||||
html {
|
||||
scroll-padding-top: 154px;
|
||||
@@ -108,7 +108,7 @@ html {
|
||||
border-radius: 0;
|
||||
}
|
||||
.docs-nav-sections nav .hv-link[aria-current="page"] {
|
||||
border-color: var(--foreground);
|
||||
border-color: var(--accent);
|
||||
color: var(--foreground);
|
||||
}
|
||||
.docs-nav-sections .framework {
|
||||
@@ -169,16 +169,17 @@ html {
|
||||
}
|
||||
.sidebar-tree h2 {
|
||||
margin: 0;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
padding: 4px 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.sidebar-tree .hv-link {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
padding: 7px 12px;
|
||||
padding: 8px;
|
||||
margin: 2px 0;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
line-height: 20px;
|
||||
color: var(--muted);
|
||||
border-radius: var(--radius-field);
|
||||
word-break: keep-all;
|
||||
@@ -206,44 +207,34 @@ html {
|
||||
outline: none;
|
||||
}
|
||||
.docs-main > .page-description {
|
||||
font-size: 18px;
|
||||
line-height: 1.65;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
color: var(--muted);
|
||||
margin: 0 0 32px;
|
||||
margin: 16px 0 32px;
|
||||
}
|
||||
.docs-main > h1 {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
line-height: 42px;
|
||||
letter-spacing: -0.6px;
|
||||
margin: 16px 0;
|
||||
margin: 0;
|
||||
outline: none;
|
||||
}
|
||||
.docs-main .breadcrumb {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.docs-main .breadcrumb .hv-link {
|
||||
font-size: 13px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.docs-main .breadcrumb [aria-current="page"] {
|
||||
color: var(--foreground);
|
||||
}
|
||||
.source-links {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: -12px 0 32px;
|
||||
margin: -8px 0 32px;
|
||||
}
|
||||
.source-links .hv-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid var(--docs-border);
|
||||
border-radius: 7px;
|
||||
font-size: 12px;
|
||||
padding: 5px 12px;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: var(--default);
|
||||
font-size: 14px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.source-links .hv-link:hover {
|
||||
@@ -277,6 +268,7 @@ html {
|
||||
}
|
||||
.toc-links .hv-link {
|
||||
display: block;
|
||||
border-radius: 0;
|
||||
padding: 6px 8px 6px 12px;
|
||||
line-height: 1.5;
|
||||
font-size: 13px;
|
||||
@@ -285,6 +277,9 @@ html {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.toc-links .hv-link[aria-current="location"] {
|
||||
box-shadow: inset 1px 0 var(--foreground);
|
||||
}
|
||||
.toc-links .hv-link.nested {
|
||||
padding-left: 24px;
|
||||
}
|
||||
@@ -348,28 +343,85 @@ html {
|
||||
}
|
||||
.components-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
column-gap: 16px;
|
||||
row-gap: 40px;
|
||||
}
|
||||
.component-index-card {
|
||||
padding: 18px;
|
||||
border: 1px solid var(--docs-border);
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 9px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
overflow: visible;
|
||||
}
|
||||
.component-index-preview {
|
||||
position: relative;
|
||||
height: 198px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--separator);
|
||||
border-radius: 12px;
|
||||
}
|
||||
.component-index-card:hover {
|
||||
background: var(--default-soft);
|
||||
.component-index-preview > img,
|
||||
.component-thumbnail-fallback {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.component-index-card .hv-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
font-size: 14px;
|
||||
.component-thumbnail-dark,
|
||||
.dark .component-thumbnail-light {
|
||||
display: none;
|
||||
}
|
||||
.component-index-card .hv-card__description {
|
||||
margin-top: 6px;
|
||||
.dark .component-thumbnail-dark {
|
||||
display: block;
|
||||
}
|
||||
.component-thumbnail-fallback {
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
align-content: center;
|
||||
}
|
||||
.component-thumbnail-fallback span {
|
||||
display: block;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.component-index-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
color: var(--foreground);
|
||||
}
|
||||
.component-index-title::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.component-index-card:hover .component-index-preview {
|
||||
border-color: var(--muted);
|
||||
}
|
||||
.component-index-card:focus-within .component-index-preview {
|
||||
outline: 2px solid var(--focus);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
@media (max-width: 1023px) {
|
||||
.components-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 639px) {
|
||||
.components-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.component-index-title {
|
||||
order: -1;
|
||||
}
|
||||
}
|
||||
.search-trigger {
|
||||
display: flex;
|
||||
@@ -667,9 +719,6 @@ html {
|
||||
.source-links .hv-link {
|
||||
font-size: 11px;
|
||||
}
|
||||
.components-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.page-navigation .hv-card {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ body {
|
||||
}
|
||||
/* Documentation prose is isolated from every live component example. */
|
||||
.docs-content {
|
||||
font-size: 14px;
|
||||
line-height: 1.85;
|
||||
font-size: 16px;
|
||||
line-height: 1.75;
|
||||
}
|
||||
.docs-content :is(h2, h3, h4):not(:where(.not-prose, .not-prose *)) {
|
||||
font-weight: 600;
|
||||
@@ -55,12 +55,17 @@ body {
|
||||
scroll-margin-top: 154px;
|
||||
}
|
||||
.docs-content h2:not(:where(.not-prose, .not-prose *)) {
|
||||
font-size: 23px;
|
||||
font-size: 24px;
|
||||
line-height: 1.333333;
|
||||
letter-spacing: -0.5px;
|
||||
margin: 40px 0 20px;
|
||||
margin: 48px 0 24px;
|
||||
}
|
||||
.docs-content > h2:first-child,
|
||||
.docs-content > div > h2:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.docs-content h3:not(:where(.not-prose, .not-prose *)) {
|
||||
font-size: 18px;
|
||||
font-size: 20px;
|
||||
margin: 32px 0 16px;
|
||||
}
|
||||
.docs-content h4:not(:where(.not-prose, .not-prose *)) {
|
||||
@@ -104,9 +109,9 @@ body {
|
||||
}
|
||||
.docs-content div[class*="language-"] {
|
||||
position: relative;
|
||||
border: 1px solid var(--docs-border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface);
|
||||
border: 0;
|
||||
border-radius: 12px;
|
||||
background: var(--default);
|
||||
margin: 16px 0;
|
||||
}
|
||||
.docs-content div[class*="language-"] > .lang {
|
||||
@@ -190,9 +195,9 @@ body {
|
||||
min-width: 0;
|
||||
height: 30px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--docs-border);
|
||||
border: 0;
|
||||
border-radius: 6px;
|
||||
background: var(--surface);
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user