mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-11 00:14:42 +01:00
Show card
This commit is contained in:
parent
514880bf0e
commit
a7e05c9d03
28
renderer/components/timelines/status/Card.tsx
Normal file
28
renderer/components/timelines/status/Card.tsx
Normal file
@ -0,0 +1,28 @@
|
||||
import { Entity } from 'megalodon'
|
||||
|
||||
type Props = {
|
||||
card: Entity.Card
|
||||
}
|
||||
|
||||
export default function Card(props: Props) {
|
||||
const openCard = () => {
|
||||
global.ipc.invoke('open-browser', props.card.url)
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex border-inherit border border-solid rounded-md w-full cursor-pointer overflow-hidden text-ellipsis"
|
||||
onClick={openCard}
|
||||
>
|
||||
<div style={{ height: '60px', width: '60px' }}>
|
||||
<img src={props.card.image} alt={props.card.title} className="w-full h-full" />
|
||||
</div>
|
||||
<div className="px-2" style={{ height: '60px', width: 'calc(100% - 60px)' }}>
|
||||
<p className="text-ellipsis overflow-hidden w-full whitespace-nowrap">
|
||||
<strong>{props.card.title}</strong>
|
||||
</p>
|
||||
<p className="text-ellipsis overflow-hidden w-full whitespace-nowrap">{props.card.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -4,6 +4,7 @@ import dayjs from 'dayjs'
|
||||
import Body from './Body'
|
||||
import Media from './Media'
|
||||
import emojify from '@/utils/emojify'
|
||||
import Card from './Card'
|
||||
|
||||
type Props = {
|
||||
status: Entity.Status
|
||||
@ -34,6 +35,7 @@ export default function Status(props: Props) {
|
||||
</div>
|
||||
</div>
|
||||
<Body status={status} />
|
||||
{status.card && <Card card={status.card} />}
|
||||
<Media media={status.media_attachments} />
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user