remove usage of createStyles from mantine that is removed in v7

This commit is contained in:
Athou
2023-12-29 21:53:41 +01:00
parent dade873420
commit 2742b7fff6
16 changed files with 415 additions and 240 deletions

View File

@@ -1,6 +1,7 @@
import { Box, createStyles, Space, Text } from "@mantine/core"
import { Box, type MantineTheme, Space, Text, useMantineTheme } from "@mantine/core"
import { type Entry } from "app/types"
import { RelativeDate } from "components/RelativeDate"
import { tss } from "tss"
import { FeedEntryTitle } from "./FeedEntryTitle"
import { FeedFavicon } from "./FeedFavicon"
@@ -9,18 +10,28 @@ export interface FeedEntryHeaderProps {
expanded: boolean
}
const useStyles = createStyles((theme, props: FeedEntryHeaderProps) => ({
headerText: {
fontWeight: theme.colorScheme === "light" && !props.entry.read ? "bold" : "inherit",
},
headerSubtext: {
display: "flex",
alignItems: "center",
fontSize: "90%",
},
}))
const useStyles = tss
.withParams<{
theme: MantineTheme
read: boolean
}>()
.create(({ theme, read }) => ({
headerText: {
fontWeight: theme.colorScheme === "light" && !read ? "bold" : "inherit",
},
headerSubtext: {
display: "flex",
alignItems: "center",
fontSize: "90%",
},
}))
export function FeedEntryHeader(props: FeedEntryHeaderProps) {
const { classes } = useStyles(props)
const theme = useMantineTheme()
const { classes } = useStyles({
theme,
read: props.entry.read,
})
return (
<Box>
<Box className={classes.headerText}>