refactor: update text color scheme across multiple components

- Replaced instances of 'text-foreground' with 'text-text' for improved consistency in styling.
- Adjusted various components including MarkdownLink, AchievementModalContent, and others to align with the new color scheme.
- Enhanced readability and visual coherence throughout the application.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-04-23 23:23:48 +08:00
parent 9222553869
commit 3fb0f6726d
25 changed files with 48 additions and 51 deletions
@@ -35,7 +35,7 @@ export const MarkdownLink = (props: LinkProps) => {
<MagneticHoverEffect
as="a"
draggable="false"
className="text-foreground before:!bg-accent/50 font-semibold no-underline"
className="text-text before:!bg-accent/50 font-semibold no-underline"
href={populatedFullHref}
title={props.title}
target="_blank"
@@ -105,8 +105,8 @@ export const toastFetchError = (
createElement(CopyButton, {
className: cn(
"relative z-[1] float-end -mt-1",
"border-transparent bg-theme-background text-theme-foreground opacity-60 transition-opacity",
"hover:bg-theme-button-hover hover:opacity-100 focus:border-theme-foreground/20",
"border-transparent bg-theme-background text-text opacity-60 transition-opacity",
"hover:bg-theme-button-hover hover:opacity-100 focus:border-text-tertiary",
),
key: "copy",
value: _reason,
@@ -271,7 +271,7 @@ export const AchievementModalContent: FC = () => {
className={styledButtonVariant({
variant: "outline",
className: [
"dark:text-foreground relative gap-1 border-green-200 !bg-green-100/50 text-green-800 dark:border-green-200/20 dark:!bg-green-100/5",
"dark:text-text relative gap-1 border-green-200 !bg-green-100/50 text-green-800 dark:border-green-200/20 dark:!bg-green-100/5",
copy.video ? "cursor-button" : "cursor-default",
],
})}
@@ -292,7 +292,7 @@ export const AchievementModalContent: FC = () => {
className={styledButtonVariant({
variant: "outline",
className:
"dark:text-foreground relative cursor-not-allowed gap-1 border-zinc-200 !bg-zinc-100/50 text-zinc-800 dark:border-zinc-200/20 dark:!bg-zinc-100/5",
"dark:text-text relative cursor-not-allowed gap-1 border-zinc-200 !bg-zinc-100/50 text-zinc-800 dark:border-zinc-200/20 dark:!bg-zinc-100/5",
})}
>
Validating...
@@ -319,7 +319,7 @@ export const TargetActionList = ({ index }: { index: number }) => {
<div className="relative w-full space-y-4">
<DropdownMenu>
<DropdownMenuTrigger asChild disabled={disabled}>
<ActionButton className="hover:text-foreground absolute right-0 top-0 -translate-y-11 text-zinc-500 duration-200">
<ActionButton className="hover:text-text absolute right-0 top-0 -translate-y-11 text-zinc-500 duration-200">
<i className="i-mgc-add-cute-re" />
</ActionButton>
</DropdownMenuTrigger>
@@ -80,7 +80,7 @@ export const ActivationModalContent = ({
render={({ field }) => (
<FormItem className="flex flex-col items-center gap-2 md:block">
{!hideDescription && (
<FormLabel className="!text-foreground">{t("activation.description")}</FormLabel>
<FormLabel className="!text-text">{t("activation.description")}</FormLabel>
)}
<FormControl>
<Input
@@ -275,7 +275,7 @@ const createRelatedEntryLink = (variant: "toast" | "modal") => (props: LinkProps
return (
<button
type="button"
className="follow-link--underline text-foreground cursor-pointer font-semibold no-underline"
className="follow-link--underline text-text cursor-pointer font-semibold no-underline"
onClick={() => {
peekModal(entryId, variant)
}}
@@ -532,7 +532,7 @@ const SnowflakeId: React.FC<SnowflakeIdProps> = ({ id: entryId, index }) => {
return (
<button
type="button"
className="follow-link--underline text-foreground cursor-pointer font-semibold no-underline"
className="follow-link--underline text-text cursor-pointer font-semibold no-underline"
onClick={() => {
peekModal(entryId, "modal")
}}
@@ -41,7 +41,7 @@ const FeedMaintainers = ({ maintainers }: { maintainers?: string[] }) => {
}
return (
<div className="text-theme-foreground/80 mb-2 flex flex-col gap-x-1 text-sm">
<div className="text-text mb-2 flex flex-col gap-x-1 text-sm">
<Trans
i18nKey="discover.feed_maintainers"
components={{
@@ -53,7 +53,7 @@ const FeedMaintainers = ({ maintainers }: { maintainers?: string[] }) => {
key={maintainer}
target="_blank"
rel="noreferrer noopener"
className="text-theme-foreground/50 hover:text-accent inline-flex cursor-pointer items-center duration-200"
className="text-text-secondary hover:text-accent inline-flex cursor-pointer items-center duration-200"
>
@{maintainer}
<i className="i-mgc-external-link-cute-re ml-0.5" />
@@ -252,9 +252,9 @@ export const DiscoverFeedForm = ({
return (
<FormItem key={keyItem.name} className="flex flex-col space-y-2">
<FormLabel className="capitalize">
<FormLabel className="text-text text-headline pl-3 capitalize">
{keyItem.name}
{!keyItem.optional && <sup className="ml-1 align-sub text-red-500">*</sup>}
{!keyItem.optional && <sup className="text-red ml-1 align-sub">*</sup>}
</FormLabel>
{parameters?.options ? (
<Select
@@ -294,7 +294,7 @@ export const DiscoverFeedForm = ({
/>
)}
{!!parameters && (
<Markdown className="text-theme-foreground/50 w-full max-w-full text-xs">
<Markdown className="text-text-secondary text-footnote w-full max-w-full pl-3">
{parameters.description}
</Markdown>
)}
@@ -302,17 +302,17 @@ export const DiscoverFeedForm = ({
)
})}
{routeParams && (
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
<div className="grid grid-cols-1 gap-x-2 gap-y-5 sm:grid-cols-2">
{Object.entries(routeParams).map(([key, value]) => (
<FormItem key={`${routeParamsKeyPrefix}${key}`} className="flex flex-col space-y-2">
<FormLabel className="capitalize">{key}</FormLabel>
<FormLabel className="text-text text-headline pl-3 capitalize">{key}</FormLabel>
<Input
{...form.register(`${routeParamsKeyPrefix}${key}`)}
placeholder={value.default}
className="grow-0"
/>
{!!value.description && (
<Markdown className="text-theme-foreground/50 w-full max-w-full text-xs">
<Markdown className="text-text-secondary text-footnote w-full max-w-full pl-3">
{value.description}
</Markdown>
)}
@@ -358,10 +358,11 @@ const PreviewUrl: FC<{
const renderedPath = `${routePrefix}${fullPath}`
return (
<div className="group relative min-w-0 pb-4">
<pre className="text-theme-foreground/40 w-full whitespace-pre-line break-words text-xs">
<pre className="text-text-tertiary w-full whitespace-pre-line break-words text-xs">
{renderedPath}
</pre>
<CopyButton
variant="outline"
value={renderedPath}
className="absolute right-0 top-0 opacity-0 duration-200 group-hover:opacity-100"
/>
@@ -69,7 +69,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(
</CardTitle>
</CardHeader>
<CardContent className="flex grow flex-col p-5 pt-0">
<ul className="text-foreground/90 grow columns-2 gap-2 space-y-1 text-sm">
<ul className="text-text grow columns-2 gap-2 space-y-1 text-sm">
{Object.keys(data.routes).map((route) => {
const routeData = data.routes[route]!
// some routes have multiple paths, like `huxiu`
@@ -79,7 +79,7 @@ export const RecommendationCard: FC<RecommendationCardProps> = memo(
return (
<li
key={route}
className="hover:text-theme-foreground-hover group ml-1"
className="hover:text-accent group ml-1"
onClick={(e) => {
;(e.target as HTMLElement).querySelector("button")?.click()
}}
@@ -401,7 +401,7 @@ const CollapsedSocialMediaItem: Component<{
collapsedItemCache.put(entryId, true)
}}
aria-hidden
className="hover:text-foreground flex items-center justify-center text-xs duration-200"
className="hover:text-text flex items-center justify-center text-xs duration-200"
>
<i className="i-mingcute-arrow-to-down-line" />
<span className="ml-2">{t("words.show_more")}</span>
@@ -75,7 +75,7 @@ export const MarkAllReadButton = forwardRef<HTMLButtonElement, MarkAllButtonProp
/>
{shortcut && (
<div className="ml-1">
<KbdCombined className="text-foreground/80">
<KbdCombined className="text-text-secondary">
{shortcuts.entries.markAllAsRead.key}
</KbdCombined>
</div>
@@ -55,13 +55,13 @@ function EntryHeaderImpl({ view, entryId, className, compact }: EntryHeaderProps
initial={{ opacity: 0.01, y: 30 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0.01, y: 30 }}
className="text-theme-foreground flex min-w-0 shrink items-end gap-2 truncate text-sm leading-tight"
className="text-text text-title3 flex min-w-0 shrink items-end gap-2 truncate leading-tight"
>
<span className="min-w-[50%] shrink truncate font-bold">
{entryTitleMeta.title}
</span>
<i className="i-mgc-line-cute-re size-[10px] shrink-0 translate-y-[-3px] rotate-[-25deg]" />
<span className="shrink truncate text-xs opacity-80">
<span className="text-text-secondary text-headline shrink truncate">
{entryTitleMeta.description}
</span>
</m.div>
@@ -59,7 +59,7 @@ function EntryHeaderImpl({ view, entryId, className }: EntryHeaderProps) {
transform: shouldShowMeta ? "translateY(0)" : "translateY(30px)",
opacity: shouldShowMeta ? 1 : 0,
}}
className="text-theme-foreground pointer-events-auto flex w-full min-w-0 shrink gap-2 truncate px-1.5 pl-10 text-sm leading-tight duration-200"
className="text-text pointer-events-auto flex w-full min-w-0 shrink gap-2 truncate px-1.5 pl-10 text-sm leading-tight duration-200"
>
<div className="flex min-w-0 grow items-center">
<div className="flex min-w-0 shrink items-end gap-1 truncate">
@@ -325,7 +325,7 @@ function Step({ step, currentStep }: { step: number; currentStep: number }) {
inactive: {
backgroundColor: "var(--fo-background)",
borderColor: "hsl(var(--border) / 0.5)",
color: "hsl(var(--fo-foreground) / 0.2)",
color: "hsl(var(--color-textTertiary))",
},
active: {
backgroundColor: "var(--fo-background)",
@@ -149,7 +149,7 @@ const CmdFImpl: FC<{
<CanvasText
scrollLeft={scrollLeft}
className="[&::placeholder]:text-foreground pointer-events-none absolute inset-0 size-full text-transparent"
className="[&::placeholder]:text-text pointer-events-none absolute inset-0 size-full text-transparent"
text={value}
/>
</div>
@@ -205,7 +205,7 @@ const drawText = (canvas: HTMLCanvasElement, text: string, scrollLeft: number) =
const rootStyles = getComputedStyle(document.documentElement)
const textColor = `hsl(${rootStyles.getPropertyValue("--foreground").trim()})`
const textColor = `hsl(${rootStyles.getPropertyValue("--color-text").trim()})`
ctx.scale(dpr, dpr)
ctx.clearRect(0, 0, canvas.width, canvas.height)
@@ -138,13 +138,13 @@ export const SearchCmdK: React.FC = () => {
onOpenChange={setAppSearchOpen}
className={cn(
"h-[600px] max-h-[80vh] w-[800px] max-w-[100vw] rounded-none md:h-screen md:max-h-[60vh] md:max-w-[80vw]",
"flex min-h-[50vh] flex-col bg-zinc-50/85 shadow-2xl backdrop-blur-xl md:rounded-xl dark:bg-neutral-900/90",
"border-0 border-zinc-300 md:border dark:border-zinc-700",
"backdrop-blur-background bg-material-ultra-thick flex min-h-[50vh] flex-col shadow-2xl md:rounded-xl",
"border-border border-0 md:border",
"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
)}
>
<Command.Input
className="w-full shrink-0 border-b border-zinc-200 bg-transparent p-4 px-5 text-lg leading-4 dark:border-neutral-700"
className="border-border w-full shrink-0 border-b bg-transparent p-4 px-5 text-lg leading-4"
ref={inputRef}
placeholder={searchActions.getCurrentKeyword() || t("search.placeholder")}
onValueChange={handleSearch}
@@ -348,7 +348,7 @@ const SearchOptions: Component = memo(({ children }) => {
const searchInstance = React.useContext(SearchCmdKContext)
return (
<div className="text-theme-foreground/80 flex items-center gap-2 text-sm">
<div className="text-text flex items-center gap-2 text-sm">
<span className="shrink-0">{t("search.options.search_type")}</span>
<Select
@@ -172,8 +172,8 @@ const SettingItemButtonImpl = (props: {
return (
<button
className={cn(
"text-theme-foreground/70 my-0.5 flex w-full items-center rounded-lg px-2.5 py-0.5 leading-loose",
tab === path && "!bg-theme-item-active !text-theme-foreground/90",
"text-text-secondary my-0.5 flex w-full items-center rounded-lg px-2.5 py-0.5 leading-loose",
tab === path && "!bg-theme-item-active !text-text",
!IN_ELECTRON && "hover:bg-theme-item-hover duration-200",
disabled && "cursor-not-allowed opacity-50",
)}
@@ -51,7 +51,7 @@ export const SettingAbout = () => {
? `${currentEnvironment}\n**Renderer**: ${rendererVersion}`
: currentEnvironment
}
className="text-foreground/80 hover:bg-theme-item-hover hover:text-foreground active:bg-theme-item-active border-0 bg-transparent p-1 [&_i]:size-3"
className="text-text-secondary hover:bg-theme-item-hover hover:text-text active:bg-theme-item-active border-0 bg-transparent p-1 [&_i]:size-3"
/>
</div>
</div>
@@ -38,10 +38,10 @@ export const ViewSelectorRadioGroup = forwardRef<
<label
htmlFor={view.name}
className={cn(
"hover:text-theme-foreground dark:hover:text-white",
"hover:text-text",
view.peerClassName,
"center flex h-10 flex-col text-xs leading-none opacity-80 duration-200",
"text-neutral-800 dark:text-zinc-200",
"text-text-secondary",
"peer-checked:opacity-100",
"whitespace-nowrap",
)}
@@ -78,7 +78,7 @@ const TipModalContent_: FC<{
if (!myWalletData) {
return (
<div className="flex w-[80vw] max-w-[350px] flex-col gap-5">
<p className="text-theme-foreground/80 text-sm">{t("tip_modal.no_wallet")}</p>
<p className="text-text text-sm">{t("tip_modal.no_wallet")}</p>
<div className="flex justify-end">
<Button variant="primary" onClick={() => nextFrame(() => navigate("/power"))}>
{t("tip_modal.create_wallet")}
@@ -91,7 +91,7 @@ const TipModalContent_: FC<{
if (tipMutation.isSuccess) {
return (
<div className="flex w-[80vw] max-w-[350px] flex-col gap-5">
<p className="text-theme-foreground/80 text-sm">{t("tip_modal.tip_sent")}</p>
<p className="text-text text-sm">{t("tip_modal.tip_sent")}</p>
<p>
<Balance className="mr-1 text-sm" withSuffix>
{amountBigInt}
@@ -122,9 +122,7 @@ const TipModalContent_: FC<{
) : (
<>
<p className="leading-none">
<span className="text-theme-foreground/80 text-xs">
{t("tip_modal.unclaimed_feed")}
</span>
<span className="text-text text-xs">{t("tip_modal.unclaimed_feed")}</span>
</p>
<div className="text-center">
<Button variant="text" className="w-fit p-0" onClick={() => claimFeed({ feedId })}>
@@ -134,7 +132,7 @@ const TipModalContent_: FC<{
</>
)}
<Divider className="my-2" />
<p className="text-theme-foreground/80 text-sm">{t("tip_modal.tip_support")}</p>
<p className="text-text text-sm">{t("tip_modal.tip_support")}</p>
<div className="flex flex-col justify-center gap-y-2">
<div className="flex flex-row items-center gap-x-2 font-bold">
@@ -61,8 +61,8 @@ const SettingItemButton = (props: { tab: string; item: SettingPageConfig; path:
return (
<button
className={cn(
"text-theme-foreground/70 my-0.5 flex w-full items-center rounded-lg px-2.5 py-0.5 leading-loose",
tab === path && "!bg-theme-item-active !text-theme-foreground/90",
"text-text-secondary my-0.5 flex w-full items-center rounded-lg px-2.5 py-0.5 leading-loose",
tab === path && "!bg-theme-item-active !text-text",
!IN_ELECTRON && "hover:bg-theme-item-hover duration-200",
disabled && "cursor-not-allowed opacity-50",
)}
@@ -57,7 +57,7 @@
}
#root [data-button="true"][data-action="true"] {
@apply text-foreground before:bg-foreground/30 relative -mr-[16px] bg-transparent px-4 font-sans font-bold before:absolute before:inset-y-0 before:left-0 before:w-px;
@apply text-text before:bg-text-tertiary relative -mr-[16px] bg-transparent px-4 font-sans font-bold before:absolute before:inset-y-0 before:left-0 before:w-px;
}
}
-2
View File
@@ -46,7 +46,6 @@ const twConfig = {
colors: {
border: "hsl(var(--border) / <alpha-value>)",
background: "hsl(var(--background) / <alpha-value>)",
foreground: "hsl(var(--foreground) / <alpha-value>)",
accent: "hsl(var(--fo-a) / <alpha-value>)",
@@ -85,7 +84,6 @@ const twConfig = {
inactive: "hsl(var(--fo-inactive) / <alpha-value>)",
disabled: "hsl(var(--fo-disabled) / <alpha-value>)",
foreground: "hsl(var(--fo-text-primary) / <alpha-value>)",
background: "var(--fo-background)",
"foreground-hover": "hsl(var(--fo-text-primary-hover) / <alpha-value>)",
+1 -1
View File
@@ -32,7 +32,7 @@
}
body {
@apply text-theme-foreground;
@apply text-text;
}
}
+1 -1
View File
@@ -113,7 +113,7 @@ const SelectItem = React.forwardRef<
<SelectPrimitive.Item
ref={ref}
className={cn(
"cursor-select focus:bg-theme-item-active focus:text-theme-foreground pointer-events-auto relative flex w-full items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
"cursor-select focus:bg-theme-item-active focus:text-text pointer-events-auto relative flex w-full items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className,
)}
{...props}
+1 -1
View File
@@ -135,7 +135,7 @@ const TabsTrigger = React.forwardRef<HTMLDivElement, TabsTriggerProps>(
<TabsPrimitive.Trigger
ref={triggerRef as any}
className={cn(
"ring-offset-background data-[state=active]:text-theme-foreground inline-flex items-center justify-center whitespace-nowrap px-3 text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50",
"ring-offset-background data-[state=active]:text-text inline-flex items-center justify-center whitespace-nowrap px-3 text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50",
"group relative z-[1]",
tabsTriggerVariants({ variant }),
)}