From edc3fa26f9fde18fcadc2a414951fffecc056387 Mon Sep 17 00:00:00 2001 From: Ou Date: Sat, 19 Oct 2024 22:47:21 +0800 Subject: [PATCH] feat(ui): new timeline style --- src/atoms/primitiveMetadataAtom.ts | 4 ++-- src/components/column/card.tsx | 30 ++++++++++++++++++------------ src/components/header/menu.tsx | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/atoms/primitiveMetadataAtom.ts b/src/atoms/primitiveMetadataAtom.ts index 24b44d3..6c33dce 100644 --- a/src/atoms/primitiveMetadataAtom.ts +++ b/src/atoms/primitiveMetadataAtom.ts @@ -2,7 +2,7 @@ import { metadata } from "@shared/metadata" import { typeSafeObjectEntries, typeSafeObjectFromEntries } from "@shared/type.util" import type { PrimitiveAtom } from "jotai" import { atom } from "jotai" -import type { PrimitiveMetadata } from "@shared/types" +import type { ColumnID, PrimitiveMetadata, SourceID } from "@shared/types" import { verifyPrimitiveMetadata } from "@shared/verify" import { sources } from "@shared/sources" import type { Update } from "./types" @@ -37,7 +37,7 @@ function createPrimitiveMetadataAtom( return derivedAtom } -const initialMetadata = typeSafeObjectFromEntries(typeSafeObjectEntries(metadata).map(([id, val]) => [id, val.sources])) +const initialMetadata = typeSafeObjectFromEntries(typeSafeObjectEntries(metadata).map(([id, val]) => [id, val.sources] as [ColumnID, SourceID[]])) export function preprocessMetadata(target: PrimitiveMetadata) { return { data: { diff --git a/src/components/column/card.tsx b/src/components/column/card.tsx index 5b65242..062c466 100644 --- a/src/components/column/card.tsx +++ b/src/components/column/card.tsx @@ -179,7 +179,15 @@ function NewsListHot({ query }: Query) { return ( <> {items?.map((item, i) => ( - + {i + 1} @@ -200,22 +208,20 @@ function NewsListHot({ query }: Query) { function NewsListTimeLine({ query }: Query) { const items = query.data?.items return ( -
    +
      {items?.map(item => ( -
    1. -
      - +
    2. + + - {item?.extra?.date && } - - - {item.title} - - - - + + + + + {item.title}
    3. ))} diff --git a/src/components/header/menu.tsx b/src/components/header/menu.tsx index 4344fcc..cd706ec 100644 --- a/src/components/header/menu.tsx +++ b/src/components/header/menu.tsx @@ -50,7 +50,7 @@ export function Menu() { id="dropdown-menu" className={clsx([ "absolute top-2rem right-0 z-99 w-200px", - "bg-primary p-1 backdrop-blur-5 bg-op-70! rounded-xl", + "bg-primary p-1px backdrop-blur-5 bg-op-70! rounded-lg", ])} initial={{ scale: 0.9,