20260610173132
This commit is contained in:
1 parent
65685d1a6a
commit
6cb198203d
56 files changed
+4265
-1210
No files matched your search
@@ -1,11 +1,19 @@
|
||||
import styles from './styles.module.css'
|
||||
|
||||
export type LinkCardTagType = 'default' | 'success' | 'warning' | 'error' | 'info'
|
||||
|
||||
export interface LinkCardTag {
|
||||
label: string
|
||||
type?: LinkCardTagType
|
||||
}
|
||||
|
||||
export interface LinkCardProps {
|
||||
title: string
|
||||
description: string
|
||||
href: string
|
||||
icon?: string
|
||||
note?: string
|
||||
tags?: LinkCardTag[]
|
||||
}
|
||||
|
||||
function getHostname(href: string) {
|
||||
@@ -23,6 +31,7 @@ export default function LinkCard({
|
||||
href,
|
||||
icon,
|
||||
note,
|
||||
tags,
|
||||
}: LinkCardProps) {
|
||||
const hostname = getHostname(href)
|
||||
const favicon = icon || (hostname ? `https://www.google.com/s2/favicons?domain=${hostname}&sz=64` : undefined)
|
||||
@@ -34,17 +43,29 @@ export default function LinkCard({
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span className={styles.cardTopline}>
|
||||
<span className={styles.cardHeader}>
|
||||
{favicon
|
||||
? <img src={favicon} alt="" className={styles.icon} loading="lazy" />
|
||||
: <span className={styles.placeholder}>{title.charAt(0)}</span>}
|
||||
<span className={styles.title}>{title}</span>
|
||||
<span className={styles.cardTitle}>{title}</span>
|
||||
</span>
|
||||
<span className={styles.description}>{description}</span>
|
||||
{hostname && <span className={styles.host}>{hostname}</span>}
|
||||
{tags && tags.length > 0 && (
|
||||
<span className={styles.tags}>
|
||||
{tags.map((tag, index) => (
|
||||
<span
|
||||
key={index}
|
||||
className={`${styles.tag} ${styles[`tag${tag.type ? tag.type.charAt(0).toUpperCase() + tag.type.slice(1) : 'Default'}`]}`}
|
||||
>
|
||||
{tag.label}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
{note && (
|
||||
<span className={styles.note} role="tooltip">
|
||||
<span className={styles.noteLabel}>备注</span>
|
||||
<span className={styles.note}>
|
||||
<strong>备注:</strong>
|
||||
{note}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import React from 'react'
|
||||
import styles from './styles.module.css'
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode
|
||||
@@ -7,7 +6,7 @@ interface Props {
|
||||
|
||||
export default function LinkGrid({ children }: Props) {
|
||||
return (
|
||||
<div className={styles.grid}>
|
||||
<div className="row">
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -101,12 +101,6 @@ export default function SearchableLinkGrid({ groups }: SearchableLinkGridProps)
|
||||
<div className={styles.container}>
|
||||
<div className={styles.toolbar}>
|
||||
<label className={styles.searchWrapper}>
|
||||
<span className={styles.searchIcon} aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24">
|
||||
<circle cx="11" cy="11" r="7" />
|
||||
<path d="m20 20-3.5-3.5" />
|
||||
</svg>
|
||||
</span>
|
||||
<input
|
||||
type="search"
|
||||
placeholder="搜索名称、说明或链接"
|
||||
|
||||
@@ -5,66 +5,60 @@
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
position: sticky;
|
||||
top: calc(var(--ifm-navbar-height) + 0.5rem);
|
||||
z-index: 30;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.25rem 0 0.5rem;
|
||||
padding: 0.5rem 0;
|
||||
background: var(--ifm-background-color);
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
.searchWrapper {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.625rem;
|
||||
height: 44px;
|
||||
padding: 0 0.875rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
background: var(--oneao-surface-muted);
|
||||
transition: border-color 0.16s ease, box-shadow 0.16s ease;
|
||||
}
|
||||
|
||||
.searchWrapper:focus-within {
|
||||
border-color: var(--ifm-color-primary);
|
||||
box-shadow: 0 0 0 3px rgba(46, 133, 85, 0.12);
|
||||
}
|
||||
|
||||
.searchIcon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: var(--ifm-color-emphasis-500);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.searchIcon svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
.searchWrapper::before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0.9rem;
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
background: var(--ifm-color-emphasis-500);
|
||||
content: '';
|
||||
pointer-events: none;
|
||||
transform: translateY(-50%);
|
||||
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E")
|
||||
center / contain no-repeat;
|
||||
}
|
||||
|
||||
.searchInput {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: transparent;
|
||||
height: 44px;
|
||||
padding: 0 1rem 0 2.45rem;
|
||||
border: 1px solid var(--ifm-color-emphasis-200);
|
||||
border-radius: 10px;
|
||||
background-color: var(--ifm-background-surface-color);
|
||||
color: var(--ifm-font-color-base);
|
||||
font-size: 0.95rem;
|
||||
outline: none;
|
||||
transition:
|
||||
border-color 0.16s ease,
|
||||
box-shadow 0.16s ease;
|
||||
}
|
||||
|
||||
.searchInput::placeholder {
|
||||
color: var(--ifm-color-emphasis-500);
|
||||
.searchInput:focus {
|
||||
border-color: var(--ifm-color-primary);
|
||||
box-shadow: 0 0 0 3px var(--ifm-color-primary-lightest);
|
||||
}
|
||||
|
||||
.resultCount {
|
||||
flex-shrink: 0;
|
||||
color: var(--ifm-color-emphasis-600);
|
||||
font-size: 0.875rem;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
.filters {
|
||||
@@ -75,19 +69,18 @@
|
||||
|
||||
.filterButton {
|
||||
height: 34px;
|
||||
padding: 0 0.875rem;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
background: var(--oneao-surface-muted);
|
||||
color: var(--ifm-color-emphasis-700);
|
||||
font-size: 0.875rem;
|
||||
padding: 0 0.85rem;
|
||||
border: 1px solid var(--ifm-color-emphasis-300);
|
||||
border-radius: 999px;
|
||||
background: var(--ifm-background-surface-color);
|
||||
color: var(--ifm-font-color-base);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
.filterButton:hover {
|
||||
border-color: var(--ifm-color-emphasis-400);
|
||||
color: var(--ifm-color-emphasis-900);
|
||||
border-color: var(--ifm-color-primary);
|
||||
color: var(--ifm-color-primary-dark);
|
||||
}
|
||||
|
||||
.filterButton.active {
|
||||
@@ -97,13 +90,12 @@
|
||||
}
|
||||
|
||||
.sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
display: grid;
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.group {
|
||||
scroll-margin-top: calc(var(--ifm-navbar-height, 64px) + 1rem);
|
||||
scroll-margin-top: calc(var(--ifm-navbar-height) + 1rem);
|
||||
}
|
||||
|
||||
.groupHeader {
|
||||
@@ -111,20 +103,20 @@
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 0.9rem;
|
||||
padding-bottom: 0.5rem;
|
||||
border-bottom: 1px solid var(--oneao-border);
|
||||
border-bottom: 1px solid var(--ifm-color-emphasis-200);
|
||||
}
|
||||
|
||||
.groupTitle {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.4;
|
||||
font-size: 1.28rem;
|
||||
}
|
||||
|
||||
.groupCount {
|
||||
color: var(--ifm-color-emphasis-500);
|
||||
font-size: 0.8125rem;
|
||||
.groupCount,
|
||||
.subCount {
|
||||
color: var(--ifm-color-emphasis-600);
|
||||
font-size: 0.78rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -139,71 +131,62 @@
|
||||
.subHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.625rem;
|
||||
gap: 0.55rem;
|
||||
margin-bottom: 0.65rem;
|
||||
}
|
||||
|
||||
.subTitle {
|
||||
margin: 0;
|
||||
color: var(--ifm-color-emphasis-800);
|
||||
font-size: 0.95rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.subCount {
|
||||
color: var(--ifm-color-emphasis-500);
|
||||
font-size: 0.75rem;
|
||||
font-size: 1.04rem;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
min-height: 86px;
|
||||
min-height: 124px;
|
||||
flex-direction: column;
|
||||
padding: 0.72rem 0.75rem 0.7rem 0.85rem;
|
||||
border: 1px solid transparent;
|
||||
border-left: 3px solid var(--oneao-border);
|
||||
padding: 0.85rem;
|
||||
border: 1px solid var(--ifm-color-emphasis-200);
|
||||
border-radius: 8px;
|
||||
background: var(--oneao-surface-soft);
|
||||
background: var(--ifm-background-surface-color);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
|
||||
transition:
|
||||
border-color 0.16s ease,
|
||||
box-shadow 0.16s ease,
|
||||
transform 0.16s ease;
|
||||
}
|
||||
|
||||
.card:hover,
|
||||
.card:focus-visible {
|
||||
border-color: var(--ifm-color-primary);
|
||||
box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
border-color: var(--ifm-color-primary);
|
||||
background: var(--oneao-hover);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.card:focus-visible {
|
||||
outline: 2px solid var(--ifm-color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.cardTopline {
|
||||
.cardHeader {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.icon,
|
||||
.placeholder {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
flex-shrink: 0;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.icon {
|
||||
@@ -214,31 +197,64 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 6px;
|
||||
background: var(--ifm-background-surface-color);
|
||||
color: var(--ifm-color-emphasis-700);
|
||||
font-size: 0.8125rem;
|
||||
border-radius: 5px;
|
||||
background: var(--ifm-color-emphasis-100);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.title {
|
||||
min-width: 0;
|
||||
.cardTitle {
|
||||
overflow: hidden;
|
||||
color: var(--ifm-color-emphasis-900);
|
||||
font-size: 0.88rem;
|
||||
font-weight: 650;
|
||||
line-height: 1.35;
|
||||
flex: 1;
|
||||
color: var(--ifm-heading-color);
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.3rem;
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
font-size: 0.68rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tagDefault {
|
||||
background: var(--ifm-color-primary);
|
||||
}
|
||||
|
||||
.tagSuccess {
|
||||
background: var(--ifm-color-success);
|
||||
}
|
||||
|
||||
.tagWarning {
|
||||
background: var(--ifm-color-warning);
|
||||
}
|
||||
|
||||
.tagError {
|
||||
background: var(--ifm-color-danger);
|
||||
}
|
||||
|
||||
.tagInfo {
|
||||
background: var(--ifm-color-info);
|
||||
}
|
||||
|
||||
.description {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
margin-top: 0.45rem;
|
||||
margin-top: 0.55rem;
|
||||
color: var(--ifm-color-emphasis-700);
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.42;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.45;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
@@ -246,9 +262,9 @@
|
||||
.host {
|
||||
overflow: hidden;
|
||||
margin-top: auto;
|
||||
padding-top: 0.48rem;
|
||||
padding-top: 0.45rem;
|
||||
color: var(--ifm-color-emphasis-500);
|
||||
font-size: 0.7rem;
|
||||
font-size: 0.78rem;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -256,22 +272,24 @@
|
||||
.note {
|
||||
position: absolute;
|
||||
right: 0.75rem;
|
||||
bottom: calc(100% - 0.25rem);
|
||||
bottom: calc(100% - 0.15rem);
|
||||
left: 0.75rem;
|
||||
z-index: 5;
|
||||
z-index: 10;
|
||||
display: block;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid var(--oneao-border);
|
||||
padding: 0.7rem 0.75rem;
|
||||
border: 1px solid var(--ifm-color-emphasis-300);
|
||||
border-radius: 8px;
|
||||
background: var(--ifm-card-background-color);
|
||||
box-shadow: 0 12px 30px var(--oneao-shadow);
|
||||
background: var(--ifm-background-surface-color);
|
||||
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
|
||||
color: var(--ifm-color-emphasis-800);
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.6;
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.55;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translateY(0.35rem);
|
||||
transition: opacity 0.16s ease, transform 0.16s ease;
|
||||
transition:
|
||||
opacity 0.16s ease,
|
||||
transform 0.16s ease;
|
||||
}
|
||||
|
||||
.note::after {
|
||||
@@ -280,10 +298,10 @@
|
||||
bottom: -6px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-right: 1px solid var(--oneao-border);
|
||||
border-bottom: 1px solid var(--oneao-border);
|
||||
background: var(--ifm-card-background-color);
|
||||
content: "";
|
||||
border-right: 1px solid var(--ifm-color-emphasis-300);
|
||||
border-bottom: 1px solid var(--ifm-color-emphasis-300);
|
||||
background: var(--ifm-background-surface-color);
|
||||
content: '';
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
@@ -293,30 +311,21 @@
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.noteLabel {
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
color: var(--ifm-color-primary-dark);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.noResults {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 180px;
|
||||
padding: 2rem;
|
||||
border: 1px dashed var(--ifm-color-emphasis-300);
|
||||
border-radius: 8px;
|
||||
color: var(--ifm-color-emphasis-600);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.noResults p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .placeholder {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
@media (max-width: 1180px) {
|
||||
.grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 996px) {
|
||||
@@ -325,7 +334,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
@media (max-width: 768px) {
|
||||
.toolbar {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
@@ -335,13 +344,23 @@
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.filters {
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 0.15rem;
|
||||
}
|
||||
|
||||
.filterButton {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1440px) {
|
||||
@media (max-width: 520px) {
|
||||
.grid {
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user