pass theme and colorscheme in tss context to avoid repetitions (#1241)

This commit is contained in:
Athou
2024-02-12 07:37:28 +01:00
parent 3efeed6c85
commit b6107c3330
9 changed files with 48 additions and 95 deletions

View File

@@ -2,7 +2,6 @@ import { Box, Text } from "@mantine/core"
import { type Entry } from "app/types"
import { RelativeDate } from "components/RelativeDate"
import { OnDesktop } from "components/responsive/OnDesktop"
import { useColorScheme } from "hooks/useColorScheme"
import { tss } from "tss"
import { FeedEntryTitle } from "./FeedEntryTitle"
import { FeedFavicon } from "./FeedFavicon"
@@ -13,7 +12,6 @@ export interface FeedEntryHeaderProps {
const useStyles = tss
.withParams<{
colorScheme: "light" | "dark"
read: boolean
}>()
.create(({ colorScheme, read }) => ({
@@ -42,9 +40,7 @@ const useStyles = tss
}))
export function FeedEntryCompactHeader(props: FeedEntryHeaderProps) {
const colorScheme = useColorScheme()
const { classes } = useStyles({
colorScheme,
read: props.entry.read,
})
return (