mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add button in the header to open entry link (#1333)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { Trans } from "@lingui/macro"
|
||||
import { ActionIcon, Anchor, Tooltip } from "@mantine/core"
|
||||
import { markEntry } from "app/entries/thunks"
|
||||
import { useAppDispatch } from "app/store"
|
||||
import { type Entry } from "app/types"
|
||||
import { TbExternalLink } from "react-icons/tb"
|
||||
|
||||
export function OpenExternalLink(props: { entry: Entry }) {
|
||||
const dispatch = useAppDispatch()
|
||||
const onClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
dispatch(
|
||||
markEntry({
|
||||
entry: props.entry,
|
||||
read: true,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Anchor href={props.entry.url} target="_blank" rel="noreferrer" onClick={onClick}>
|
||||
<Tooltip label={<Trans>Open link</Trans>}>
|
||||
<ActionIcon variant="transparent" c="dimmed">
|
||||
<TbExternalLink />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
</Anchor>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user