mirror of
https://github.com/Athou/commafeed.git
synced 2026-11-02 18:34:48 +00:00
33 lines
808 B
TypeScript
33 lines
808 B
TypeScript
import { Highlight } from "@mantine/core"
|
|
import { useAppSelector } from "@/app/store"
|
|
import type { Entry } from "@/app/types"
|
|
import { tss } from "@/tss"
|
|
|
|
export interface FeedEntryTitleProps {
|
|
entry: Entry
|
|
}
|
|
|
|
const useStyles = tss.create(() => ({
|
|
content: {
|
|
textWrap: "inherit",
|
|
},
|
|
}))
|
|
|
|
export function FeedEntryTitle(props: Readonly<FeedEntryTitleProps>) {
|
|
const search = useAppSelector(state => state.entries.search)
|
|
const keywords = search?.split(" ")
|
|
|
|
const { classes } = useStyles()
|
|
return (
|
|
<Highlight
|
|
inherit
|
|
highlight={keywords ?? ""}
|
|
// make sure ellipsis is shown when title is too long
|
|
span
|
|
className={classes.content}
|
|
>
|
|
{props.entry.title}
|
|
</Highlight>
|
|
)
|
|
}
|