feat(desktop): re-design context menu and dropdown menu

- Added `tailwindcss-multi` dependency to enhance Tailwind CSS capabilities.
- Updated `tailwind.config.ts` to include `tailwindcss-multi` plugin for improved utility management.
- Refactored various UI components to utilize new styling options and improve layout consistency.
- Renamed `useAsRead` hook to `useEntryIsRead` for better clarity in its purpose across multiple components.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-04-23 22:32:08 +08:00
parent 1c9cb9c3ba
commit c995da3323
23 changed files with 211 additions and 128 deletions
@@ -1,11 +1,12 @@
import { Input } from "@follow/components/ui/input/index.js"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { useCorrectZIndex } from "@follow/components/ui/z-index/ctx.js"
import { stopPropagation } from "@follow/utils/dom"
import { cn } from "@follow/utils/utils"
import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions } from "@headlessui/react"
import Fuse from "fuse.js"
import { AnimatePresence, m } from "motion/react"
import { forwardRef, Fragment, useCallback, useEffect, useState } from "react"
import { forwardRef, Fragment, memo, useCallback, useEffect, useState } from "react"
export type Suggestion = {
name: string
@@ -87,37 +88,32 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
/>
<AnimatePresence>
{open && filterableSuggestions.length > 0 && (
<ComboboxOptions
portal
static
as={m.div}
initial={{ opacity: 0, scale: 0.98 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.98 }}
anchor="bottom"
style={{ zIndex }}
onWheel={stopPropagation}
className={cn(
"pointer-events-auto max-h-48 grow",
"shadow-perfect border-border bg-material-medium text-text backdrop-blur-background overflow-auto rounded-md border",
"w-[var(--input-width)] empty:invisible",
)}
>
<div style={{ maxHeight }}>
{filterableSuggestions.map((suggestion) => (
<ComboboxOption
key={suggestion.value}
value={suggestion}
className={cn(
"data-[focus]:bg-theme-item-hover dark:data-[focus]:bg-neutral-800",
"px-4 py-1.5 text-sm",
)}
>
{suggestion.name}
</ComboboxOption>
))}
</div>
</ComboboxOptions>
<RootPortal>
<ComboboxOptions
portal
static
as={m.div}
initial={{ opacity: 0, scale: 0.98 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.98 }}
anchor="bottom"
style={{ zIndex }}
onWheel={stopPropagation}
className={cn(
"z-[60]",
"bg-material-medium backdrop-blur-background text-text",
"shadow-context-menu min-w-32 overflow-hidden rounded-[6px] border p-1",
"motion-scale-in-75 motion-duration-150 text-body lg:animate-none",
"w-[var(--input-width)] empty:invisible",
)}
>
<div style={{ maxHeight }}>
{filterableSuggestions.map((suggestion) => (
<MemoizedComboboxOption key={suggestion.value} suggestion={suggestion} />
))}
</div>
</ComboboxOptions>
</RootPortal>
)}
</AnimatePresence>
</Fragment>
@@ -128,4 +124,21 @@ export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
},
)
const MemoizedComboboxOption = memo(({ suggestion }: { suggestion: Suggestion }) => {
return (
<ComboboxOption
key={suggestion.value}
value={suggestion}
className={cn(
"cursor-menu focus:bg-theme-selection-active focus:text-theme-selection-foreground",
"data-[focus]:bg-theme-selection-hover data-[focus]:text-theme-selection-foreground",
"relative flex select-none items-center rounded-[5px] px-2.5 py-1.5 outline-none",
"h-[28px]",
)}
>
{suggestion.name}
</ComboboxOption>
)
})
Autocomplete.displayName = "Autocomplete"
@@ -1,16 +1,13 @@
import { Divider } from "@follow/components/ui/divider/Divider.js"
import { RootPortal } from "@follow/components/ui/portal/index.jsx"
import { cn } from "@follow/utils/utils"
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
import * as React from "react"
const ContextMenu = ContextMenuPrimitive.Root
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
const ContextMenuGroup = ContextMenuPrimitive.Group
const ContextMenuSub = ContextMenuPrimitive.Sub
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
const ContextMenuSubTrigger = React.forwardRef<
@@ -22,7 +19,7 @@ const ContextMenuSubTrigger = React.forwardRef<
<ContextMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"cursor-menu focus:bg-theme-item-hover focus:text-theme-foreground data-[state=open]:bg-theme-item-hover data-[state=open]:text-theme-foreground flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
"cursor-menu focus:bg-theme-selection-active focus:text-theme-selection-foreground data-[state=open]:bg-theme-selection-active data-[state=open]:text-theme-selection-foreground flex select-none items-center rounded-[5px] px-2.5 py-1.5 outline-none",
inset && "pl-8",
"center gap-2",
className,
@@ -44,7 +41,10 @@ const ContextMenuSubContent = React.forwardRef<
<ContextMenuPrimitive.SubContent
ref={ref}
className={cn(
"bg-theme-modal-background-opaque text-theme-foreground/90 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 min-w-32 overflow-hidden rounded-md border p-1 shadow-lg dark:shadow-zinc-800/60",
"bg-material-medium backdrop-blur-background text-text text-body",
"min-w-32 overflow-hidden",
"rounded-[6px] border p-1",
"shadow-context-menu",
"z-[61]",
className,
)}
@@ -62,8 +62,8 @@ const ContextMenuContent = React.forwardRef<
<ContextMenuPrimitive.Content
ref={ref}
className={cn(
"border-border bg-theme-modal-background-opaque text-theme-foreground/90 z-[60] min-w-32 overflow-hidden rounded-md border p-1 shadow-lg dark:shadow-zinc-800/60",
"motion-scale-in-75 motion-duration-150 text-xs lg:animate-none",
"bg-material-medium backdrop-blur-background text-text shadow-context-menu z-[60] min-w-32 overflow-hidden rounded-[6px] border p-1",
"motion-scale-in-75 motion-duration-150 text-body lg:animate-none",
className,
)}
{...props}
@@ -81,8 +81,9 @@ const ContextMenuItem = React.forwardRef<
<ContextMenuPrimitive.Item
ref={ref}
className={cn(
"cursor-menu focus:bg-theme-item-hover focus:text-theme-foreground relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"data-[highlighted]:bg-theme-item-hover focus-within:outline-transparent dark:data-[highlighted]:bg-neutral-800",
"cursor-menu focus:bg-theme-selection-active focus:text-theme-selection-foreground relative flex select-none items-center rounded-[5px] px-2.5 py-1 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"data-[highlighted]:bg-theme-selection-hover focus-within:outline-transparent",
"h-[28px]",
inset && "pl-8",
className,
)}
@@ -98,8 +99,9 @@ const ContextMenuCheckboxItem = React.forwardRef<
<ContextMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"cursor-checkbox focus:bg-theme-item-hover focus:text-theme-foreground relative flex select-none items-center rounded-sm px-8 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"cursor-checkbox focus:bg-theme-selection-active focus:text-theme-selection-foreground relative flex select-none items-center rounded-[5px] px-8 py-1.5 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"focus-within:outline-transparent",
"h-[28px]",
className,
)}
checked={checked}
@@ -123,7 +125,7 @@ const ContextMenuLabel = React.forwardRef<
>(({ className, inset, ...props }, ref) => (
<ContextMenuPrimitive.Label
ref={ref}
className={cn("text-foreground px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
className={cn("text-text px-2 py-1.5 font-semibold", inset && "pl-8", className)}
{...props}
/>
))
@@ -132,12 +134,15 @@ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
const ContextMenuSeparator = React.forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
>(({ ...props }, ref) => (
<ContextMenuPrimitive.Separator
className="backdrop-blur-background mx-2 my-1 h-px"
asChild
ref={ref}
className={cn("bg-border -mx-1 my-1 h-px scale-x-90", className)}
{...props}
/>
>
<Divider />
</ContextMenuPrimitive.Separator>
))
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
@@ -1,3 +1,4 @@
import { Divider } from "@follow/components/ui/divider/Divider.js"
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { cn } from "@follow/utils/utils"
@@ -25,13 +26,9 @@ const DropdownMenu: typeof DropdownMenuPrimitive.Root = (props) => {
}
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
const DropdownMenuGroup = DropdownMenuPrimitive.Group
const DropdownMenuPortal = DropdownMenuPrimitive.Portal
const DropdownMenuSub = DropdownMenuPrimitive.Sub
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
const DropdownMenuSubTrigger = React.forwardRef<
@@ -43,14 +40,16 @@ const DropdownMenuSubTrigger = React.forwardRef<
<DropdownMenuPrimitive.SubTrigger
ref={ref}
className={cn(
"cursor-menu focus:bg-theme-item-hover data-[state=open]:bg-theme-item-active flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
"cursor-menu focus:bg-theme-selection-active focus:text-theme-selection-foreground data-[state=open]:bg-theme-selection-active data-[state=open]:text-theme-selection-foreground flex select-none items-center rounded-[5px] px-2.5 py-1.5 outline-none",
inset && "pl-8",
"center gap-2",
className,
props.disabled && "cursor-not-allowed opacity-30",
)}
{...props}
>
{children}
<i className="i-mingcute-down-line ml-auto size-4" />
<i className="i-mingcute-right-line -mr-1 ml-auto size-3.5" />
</DropdownMenuPrimitive.SubTrigger>
))
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName
@@ -59,14 +58,20 @@ const DropdownMenuSubContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"bg-material-medium backdrop-blur-background text-text data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-lg",
className,
)}
{...props}
/>
<RootPortal>
<DropdownMenuPrimitive.SubContent
ref={ref}
className={cn(
"bg-material-medium backdrop-blur-background text-text text-body",
"min-w-32 overflow-hidden",
"rounded-[6px] border p-1",
"shadow-context-menu",
"z-[61]",
className,
)}
{...props}
/>
</RootPortal>
))
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName
@@ -80,8 +85,8 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
"shadow-context-menu bg-material-medium backdrop-blur-background text-text z-50 min-w-32 overflow-hidden rounded-md border p-1",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"bg-material-medium backdrop-blur-background text-text shadow-context-menu z-[60] min-w-32 overflow-hidden rounded-[6px] border p-1",
"motion-scale-in-75 motion-duration-150 text-body lg:animate-none",
className,
)}
{...props}
@@ -97,14 +102,20 @@ const DropdownMenuItem = React.forwardRef<
inset?: boolean
icon?: React.ReactNode | ((props?: { isActive?: boolean }) => React.ReactNode)
active?: boolean
highlightColor?: "accent" | "gray"
}
>(({ className, inset, icon, active, ...props }, ref) => (
>(({ className, inset, icon, active, highlightColor = "accent", ...props }, ref) => (
<DropdownMenuPrimitive.Item
ref={ref}
className={cn(
"cursor-menu focus:bg-theme-item-hover data-[state=open]:bg-theme-item-active relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"cursor-menu relative flex select-none items-center rounded-[5px] px-2.5 py-1 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"focus-within:outline-transparent",
highlightColor === "accent"
? "data-[highlighted]:bg-theme-selection-hover focus:bg-theme-selection-active focus:text-theme-selection-foreground data-[highlighted]:text-theme-selection-foreground"
: "data-[highlighted]:bg-theme-item-hover focus:bg-theme-item-active",
"h-[28px]",
inset && "pl-8",
"focus-within:!outline-transparent",
className,
)}
{...props}
@@ -128,15 +139,17 @@ const DropdownMenuCheckboxItem = React.forwardRef<
<DropdownMenuPrimitive.CheckboxItem
ref={ref}
className={cn(
"cursor-menu focus:bg-theme-item-hover data-[state=open]:bg-theme-item-active relative flex select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"cursor-checkbox focus:bg-theme-selection-active focus:text-theme-selection-foreground relative flex select-none items-center rounded-[5px] px-8 py-1.5 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"focus-within:outline-transparent",
"h-[28px]",
className,
)}
checked={checked}
{...props}
>
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
<i className="i-mingcute-checkbox-line size-4" />
<span className="absolute left-2 flex items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator asChild>
<i className="i-mgc-check-filled size-3" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
@@ -152,7 +165,7 @@ const DropdownMenuLabel = React.forwardRef<
>(({ className, inset, ...props }, ref) => (
<DropdownMenuPrimitive.Label
ref={ref}
className={cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className)}
className={cn("text-text px-2 py-1.5 font-semibold", inset && "pl-8", className)}
{...props}
/>
))
@@ -161,12 +174,15 @@ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
const DropdownMenuSeparator = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
>(({ className, ...props }, ref) => (
>(({ ...props }, ref) => (
<DropdownMenuPrimitive.Separator
className="backdrop-blur-background mx-2 my-1 h-px"
asChild
ref={ref}
className={cn("bg-material-ultra-thin -mx-1 my-1 h-px", className)}
{...props}
/>
>
<Divider />
</DropdownMenuPrimitive.Separator>
))
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
@@ -340,7 +340,7 @@ const FallbackMedia: FC<MediaProps> = ({ type, mediaContainerClassName, classNam
)}
>
<div className="@sm:hidden @md:contents hidden">
<i className="i-mgc-close-cute-re text-xl text-red-500" />
<i className="i-mgc-close-cute-re text-red text-xl" />
<p>Media loaded failed</p>
<div className="space-x-1 break-all px-4 text-sm">
Go to{" "}
@@ -1,6 +1,6 @@
import { useRouteParamsSelector } from "./useRouteParams"
export function useAsRead<T extends { read: Nullable<boolean> }>(entry?: T) {
export function useEntryIsRead<T extends { read: Nullable<boolean> }>(entry?: T) {
return useRouteParamsSelector(
(params) => {
if (params.isCollection) {
@@ -17,7 +17,7 @@ import { RelativeTime } from "~/components/ui/datetime"
import { HTML } from "~/components/ui/markdown/HTML"
import { Media } from "~/components/ui/media"
import { usePreviewMedia } from "~/components/ui/media/hooks"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useEntryIsRead } from "~/hooks/biz/useAsRead"
import { useSortedEntryActions } from "~/hooks/biz/useEntryActions"
import { jotaiStore } from "~/lib/jotai"
import { parseSocialMedia } from "~/lib/parsers"
@@ -34,7 +34,7 @@ const socialMediaContentWidthAtom = atom(0)
export const SocialMediaItem: EntryListItemFC = ({ entryId, entryPreview, translation }) => {
const entry = useEntry(entryId) || entryPreview
const asRead = useAsRead(entry)
const asRead = useEntryIsRead(entry)
const feed = useFeedById(entry?.feedId)
const ref = useRef<HTMLDivElement>(null)
@@ -13,7 +13,7 @@ import {
useShowContextMenu,
} from "~/atoms/context-menu"
import { useGeneralSettingKey } from "~/atoms/settings/general"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useEntryIsRead } from "~/hooks/biz/useAsRead"
import { useEntryActions } from "~/hooks/biz/useEntryActions"
import { useFeedActions } from "~/hooks/biz/useFeedActions"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
@@ -45,7 +45,7 @@ export const EntryItemWrapper: FC<
[entry.entries.id],
)
const asRead = useAsRead(entry)
const asRead = useEntryIsRead(entry)
const hoverMarkUnread = useGeneralSettingKey("hoverMarkUnread")
const handleMouseEnter = useDebounceCallback(
@@ -2,7 +2,7 @@ import { TitleMarquee } from "@follow/components/ui/marquee/index.jsx"
import { cn } from "@follow/utils/utils"
import dayjs from "dayjs"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useEntryIsRead } from "~/hooks/biz/useAsRead"
import { EntryTranslation } from "~/modules/entry-column/translation"
import { FeedIcon } from "~/modules/feed/feed-icon"
import { FeedTitle } from "~/modules/feed/feed-title"
@@ -47,7 +47,7 @@ export const GridItemFooter = ({
const entry = useEntry(entryId) || entryPreview
const feeds = useFeedById(entry?.feedId)
const asRead = useAsRead(entry)
const asRead = useEntryIsRead(entry)
if (!entry) return null
return (
@@ -8,7 +8,7 @@ import { useRealInWideMode, useUISettingKey } from "~/atoms/settings/ui"
import { RelativeTime } from "~/components/ui/datetime"
import { Media } from "~/components/ui/media"
import { FEED_COLLECTION_LIST } from "~/constants"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useEntryIsRead } from "~/hooks/biz/useAsRead"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { EntryTranslation } from "~/modules/entry-column/translation"
import { FeedIcon } from "~/modules/feed/feed-icon"
@@ -31,7 +31,7 @@ export function ListItem({
const isMobile = useMobile()
const entry = useEntry(entryId) || entryPreview
const asRead = useAsRead(entry)
const isRead = useEntryIsRead(entry)
const inInCollection = useRouteParamsSelector((s) => s.feedId === FEED_COLLECTION_LIST)
@@ -115,7 +115,7 @@ export function ListItem({
<div
className={cn(
"cursor-menu group relative flex pl-3 pr-2",
!asRead &&
!isRead &&
"before:bg-accent before:absolute before:-left-0.5 before:top-[1.4375rem] before:block before:size-2 before:rounded-full",
settingWideMode ? "py-3" : "py-4",
)}
@@ -130,8 +130,8 @@ export function ListItem({
<div
className={cn(
"flex gap-1 text-[10px] font-bold",
asRead ? "text-zinc-400 dark:text-neutral-500" : "text-zinc-500 dark:text-zinc-400",
entry.collections && "text-zinc-600 dark:text-zinc-500",
isRead ? "text-text-tertiary" : "text-text-secondary",
entry.collections && "text-text-secondary",
)}
>
<EllipsisHorizontalTextWithTooltip className="truncate">
@@ -147,6 +147,7 @@ export function ListItem({
<div
className={cn(
"relative my-0.5 break-words",
isRead ? "text-text-secondary" : "text-text",
!!entry.collections && "pr-5",
entry.entries.title ? "font-medium" : "text-[13px]",
)}
@@ -167,14 +168,7 @@ export function ListItem({
{!!entry.collections && <StarIcon className="absolute right-0 top-0" />}
</div>
{!simple && (
<div
className={cn(
"text-[13px]",
asRead
? "text-zinc-400 dark:text-neutral-500"
: "text-zinc-500 dark:text-neutral-400",
)}
>
<div className={cn("text-[13px]", isRead ? "text-text-tertiary" : "text-text-secondary")}>
<EntryTranslation
className={cn("hyphens-auto", lineClamp.description)}
source={entry.entries.description}
@@ -4,7 +4,7 @@ import type { Target, TargetAndTransition } from "motion/react"
import { m } from "motion/react"
import { useIsZenMode } from "~/atoms/settings/ui"
import { useAsRead } from "~/hooks/biz/useAsRead"
import { useEntryIsRead } from "~/hooks/biz/useAsRead"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useGetEntryIdInRange } from "~/modules/entry-column/hooks/useEntryIdListSnap"
@@ -48,7 +48,7 @@ const TimelineItem = ({ id }: { id: string }) => {
title: e.entries.title,
read: e.read,
}))
const asRead = useAsRead(entry!)
const asRead = useEntryIsRead(entry!)
const navigate = useNavigateEntry()
const isActive = useRouteParamsSelector((r) => r.entryId === id)
@@ -71,12 +71,12 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
href={populatedFullHref ?? "#"}
target="_blank"
rel="noopener noreferrer"
className="cursor-link select-text break-words text-[1.7rem] font-bold leading-normal hover:opacity-80"
className="cursor-link hover:multi-[scale-105;opacity-95] inline-block select-text break-words text-[1.7rem] font-bold leading-normal duration-200"
>
<EntryTranslation
source={entry.entries.title}
target={translation.data?.title}
className="inline-block select-text hyphens-auto duration-200"
className="text-text inline-block select-text hyphens-auto duration-200"
inline={false}
/>
</a>
@@ -84,9 +84,9 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
{/* Meta Information with improved layout */}
<div className="flex flex-wrap items-center gap-x-6 gap-y-2 text-sm">
<div className="flex flex-wrap items-center gap-4 text-gray-500 dark:text-gray-400">
<div className="text-text-secondary [&>div:hover]:multi-['text-gray-700;dark:text-gray-300'] flex flex-wrap items-center gap-4 [&>div]:transition-colors">
<div
className="flex items-center text-xs font-medium text-zinc-800/90 duration-200 hover:text-zinc-900 dark:text-zinc-300/90 dark:hover:text-zinc-100"
className="flex items-center text-xs font-medium"
onClick={() =>
navigateEntry({
feedId: feed?.id,
@@ -96,7 +96,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
<FeedIcon fallback feed={feed || inbox} entry={entry.entries} size={16} />
{getPreferredTitle(feed || inbox, entry.entries)}
</div>
<div className="flex items-center gap-1.5 transition-colors hover:text-gray-700 dark:hover:text-gray-300">
<div className="flex items-center gap-1.5">
<i className="i-mgc-calendar-time-add-cute-re text-base" />
<span className="text-xs tabular-nums">
<RelativeTime date={entry.entries.publishedAt} dateFormatTemplate={dateFormat} />
@@ -104,7 +104,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
</div>
{estimatedMins && (
<div className="flex items-center gap-1.5 transition-colors hover:text-gray-700 dark:hover:text-gray-300">
<div className="flex items-center gap-1.5">
<i className="i-mgc-time-cute-re text-base" />
<span className="text-xs tabular-nums">{estimatedMins}</span>
</div>
@@ -116,7 +116,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
(entryHistory?.userIds?.every((id) => id !== user?.id) ? 1 : 0)
return readCount > 0 ? (
<div className="flex items-center gap-1.5 transition-colors hover:text-gray-700 dark:hover:text-gray-300">
<div className="flex items-center gap-1.5">
<i className="i-mgc-eye-2-cute-re text-base" />
<span className="text-xs tabular-nums">{readCount.toLocaleString()}</span>
</div>
@@ -66,7 +66,7 @@ export const ListHeader = ({ view }: { view: number }) => {
>
{view !== undefined && t(views[view]!.name, { ns: "common" })}
</div>
<div className="lg:!text-text-secondary ml-2 flex items-center gap-3 text-base text-zinc-400 lg:text-sm dark:text-zinc-600">
<div className="text-text-secondary ml-2 flex items-center gap-3 text-base lg:text-sm">
<SortButton />
{expansion ? (
<i
@@ -101,6 +101,7 @@ export const ProfileButton: FC<ProfileButtonProps> = memo((props) => {
</DropdownMenuLabel>
<DropdownMenuItem
highlightColor="gray"
onClick={() => {
navigate("/power")
}}
@@ -1,16 +1,15 @@
import type { WalletModel } from "@follow/models"
import { cn } from "@follow/utils/utils"
import { Balance } from "../wallet/balance"
export function PowerButton({
isLoading,
myWallet,
}: {
export const PowerButton: Component<{
isLoading: boolean
myWallet?: WalletModel
}) {
className?: string
}> = ({ isLoading, myWallet, className }) => {
return (
<div className="flex items-center gap-1">
<div className={cn("flex items-center gap-1", className)}>
<i className="i-mgc-power text-accent" />
{isLoading ? (
<span className="bg-theme-inactive h-3 w-8 animate-pulse rounded-xl" />
@@ -149,7 +149,7 @@ const Item = memo(({ item }: { item: FollowMenuItem }) => {
<span className={cn(item.icon && "pl-6")}>{item.label}</span>
{!!item.shortcut && !isMobile && (
<div className="ml-auto pl-4">
<div className="-mr-1 ml-auto pl-4">
<KbdCombined joint>{item.shortcut}</KbdCombined>
</div>
)}
+2 -1
View File
@@ -48,6 +48,7 @@ export default resolveConfig(
colors: {
sidebar: "hsl(var(--fo-sidebar) / <alpha-value>)",
},
keyframes: {
"caret-blink": {
"0%,70%,100%": { opacity: "1" },
@@ -77,7 +78,7 @@ export default resolveConfig(
addVariant("macos", ":where(html[data-os='macOS']) &")
addVariant("windows", ":where(html[data-os='Windows']) &")
}),
require("tailwindcss-multi"),
plugin(({ addUtilities, matchUtilities, theme }) => {
addUtilities({
".safe-inset-top": {
+26 -1
View File
@@ -6,7 +6,8 @@ import path, { resolve } from "node:path"
import { getIconCollections, iconsPlugin } from "@egoist/tailwindcss-icons"
import { cleanupSVG, importDirectorySync, isEmptyColor, parseColors, runSVGO } from "@iconify/tools"
import { compareColors, stringToColor } from "@iconify/utils/lib/colors"
import type { Config } from "tailwindcss"
import { theme } from "tailwindcss/defaultConfig"
import type { Config } from "tailwindcss/types/config"
import { withUIKit } from "tailwindcss-uikit-colors/src/macos/tailwind"
const twConfig = {
@@ -22,6 +23,20 @@ const twConfig = {
},
},
fontSize: {
...theme?.fontSize,
largeTitle: ["26px", "32px"],
title1: ["22px", "26px"],
title2: ["17px", "22px"],
title3: ["15px", "20px"],
headline: ["13px", "16px"],
body: ["13px", "16px"],
callout: ["12px", "15px"],
subheadline: ["11px", "14px"],
footnote: ["10px", "13px"],
caption: ["10px", "13px"],
},
extend: {
fontFamily: {
theme: "var(--fo-font-family)",
@@ -52,10 +67,20 @@ const twConfig = {
"950": "#451505",
},
boxShadow: {
"context-menu":
"0px 0px 1px rgba(0, 0, 0, 0.4), 0px 0px 1.5px rgba(0, 0, 0, 0.3), 0px 7px 22px rgba(0, 0, 0, 0.25)",
},
item: {
active: "var(--fo-item-active)",
hover: "var(--fo-item-hover)",
},
selection: {
active: "var(--fo-selection-active)",
hover: "var(--fo-selection-hover)",
foreground: "var(--fo-selection-foreground)",
},
inactive: "hsl(var(--fo-inactive) / <alpha-value>)",
disabled: "hsl(var(--fo-disabled) / <alpha-value>)",
+1
View File
@@ -70,6 +70,7 @@
"tailwindcss": "3.4.17",
"tailwindcss-animate": "1.0.7",
"tailwindcss-motion": "1.1.0",
"tailwindcss-multi": "0.4.6",
"tailwindcss-safe-area": "0.6.0",
"tailwindcss-uikit-colors": "0.5.1",
"tar": "7.4.3",
@@ -26,6 +26,10 @@
--border: 20 5.9% 90%;
--radius: 0.5rem;
--fo-selection-active: theme(colors.accent/90);
--fo-selection-hover: theme(colors.accent/80);
--fo-selection-foreground: theme(colors.white);
}
@media (prefers-color-scheme: dark) {
+5
View File
@@ -1,3 +1,8 @@
:root {
--fo-selection-active: theme(colors.accent/90);
--fo-selection-hover: theme(colors.accent/80);
--fo-selection-foreground: theme(colors.white);
}
[data-theme="light"] {
--fo-a: 21.6 100% 50%;
@@ -9,7 +9,7 @@ export const Divider: FC<DetailedHTMLProps<HTMLAttributes<HTMLHRElement>, HTMLHR
<hr
className={cn(
"my-4 h-[0.5px] border-0",
"bg-[#282828] !opacity-[0.36] dark:bg-[#F6F6F6]",
"bg-[rgba(0,0,0,0.1)] dark:bg-[rgba(255,255,255,0.1)]",
className,
)}
{...rest}
@@ -25,7 +25,7 @@ export const DividerVertical: FC<
<span
className={cn(
"mx-3 inline-block h-full w-[0.5px] select-none text-transparent",
"bg-[#282828] opacity-[0.36] dark:bg-[#F6F6F6]",
"bg-[rgba(0,0,0,0.1)] dark:bg-[rgba(255,255,255,0.1)]",
className,
)}
{...rest}
+1 -10
View File
@@ -39,15 +39,6 @@ SpecialKeys.iOS = SpecialKeys.macOS
// @ts-ignore
SpecialKeys.Android = SpecialKeys.Linux
// const allSpecialKeys = new Set(
// [
// SpecialKeys.Windows,
// SpecialKeys.macOS,
// SpecialKeys.Linux,
// SharedKeys,
// ].flatMap((element) => Object.values(element)),
// )
const os = getOS()
export const KbdCombined: FC<{
children: string
@@ -331,7 +322,7 @@ export const Kbd: FC<{ children: string; className?: string }> = memo(({ childre
<button type="button" onClick={handleClick}>
<kbd
className={cn(
"kbd box-border h-5 space-x-1 font-sans text-[0.7rem]",
"kbd text-text box-border h-5 space-x-1 font-sans text-[0.7rem]",
isKeyPressed ? "" : "border-b-2",
className,
+30 -2
View File
@@ -178,6 +178,9 @@ importers:
tailwindcss-motion:
specifier: 1.1.0
version: 1.1.0(tailwindcss@3.4.17(ts-node@10.9.2(@types/node@22.14.1)(typescript@5.8.3)))
tailwindcss-multi:
specifier: 0.4.6
version: 0.4.6
tailwindcss-safe-area:
specifier: 0.6.0
version: 0.6.0(tailwindcss@3.4.17(ts-node@10.9.2(@types/node@22.14.1)(typescript@5.8.3)))
@@ -13994,6 +13997,9 @@ packages:
peerDependencies:
tailwindcss: '>=3.0.0 || insiders'
tailwindcss-multi@0.4.6:
resolution: {integrity: sha512-Bn9yLrMkeYFrJjRYuuTfqT9ibm6U2qnTwlIKYchWyGX3qgL+1+NN4JgiHJG1qrR4QQeU28eCl8sMSBobdzijvQ==}
tailwindcss-safe-area@0.6.0:
resolution: {integrity: sha512-5PM3CKquzmaa6mow64zWJ0438/yGSqdPfjaXtwNDb31LezNWqFoGPSbvrW12T8iB4EBjeWot+qAA9nbUqqf3sw==}
engines: {node: '>=16'}
@@ -20165,7 +20171,7 @@ snapshots:
debug: 2.6.9
invariant: 2.2.4
metro: 0.81.4(bufferutil@4.0.9)
metro-config: 0.81.4(bufferutil@4.0.9)(utf-8-validate@6.0.5)
metro-config: 0.81.4(bufferutil@4.0.9)
metro-core: 0.81.4
readline: 1.3.0
semver: 7.7.1
@@ -27380,6 +27386,21 @@ snapshots:
flow-enums-runtime: 0.0.6
metro-core: 0.81.4
metro-config@0.81.4(bufferutil@4.0.9):
dependencies:
connect: 3.7.0
cosmiconfig: 5.2.1
flow-enums-runtime: 0.0.6
jest-validate: 29.7.0
metro: 0.81.4(bufferutil@4.0.9)
metro-cache: 0.81.4
metro-core: 0.81.4
metro-runtime: 0.81.4
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
metro-config@0.81.4(bufferutil@4.0.9)(utf-8-validate@6.0.5):
dependencies:
connect: 3.7.0
@@ -27394,6 +27415,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
optional: true
metro-core@0.81.4:
dependencies:
@@ -27505,6 +27527,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
optional: true
metro@0.81.4(bufferutil@4.0.9):
dependencies:
@@ -27532,7 +27555,7 @@ snapshots:
metro-babel-transformer: 0.81.4
metro-cache: 0.81.4
metro-cache-key: 0.81.4
metro-config: 0.81.4(bufferutil@4.0.9)(utf-8-validate@6.0.5)
metro-config: 0.81.4(bufferutil@4.0.9)
metro-core: 0.81.4
metro-file-map: 0.81.4
metro-resolver: 0.81.4
@@ -27599,6 +27622,7 @@ snapshots:
- bufferutil
- supports-color
- utf-8-validate
optional: true
micromark-core-commonmark@2.0.3:
dependencies:
@@ -30765,6 +30789,10 @@ snapshots:
dependencies:
tailwindcss: 3.4.17(ts-node@10.9.2(@types/node@22.14.1)(typescript@5.8.3))
tailwindcss-multi@0.4.6:
dependencies:
'@types/node': 20.17.30
tailwindcss-safe-area@0.6.0(tailwindcss@3.4.17(ts-node@10.9.2(@types/node@22.14.1)(typescript@5.8.3))):
dependencies:
tailwindcss: 3.4.17(ts-node@10.9.2(@types/node@22.14.1)(typescript@5.8.3))