mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2026-01-30 09:48:12 +01:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import type {FC} from 'react';
|
|
import {Card} from '../../../components/Card/Card';
|
|
import {Button} from '../../../components/Button/Button';
|
|
import styles from './TabInfo.module.scss';
|
|
|
|
interface TabInfoProps {
|
|
title: string;
|
|
url: string;
|
|
favIconUrl?: string;
|
|
onReload: () => void;
|
|
}
|
|
|
|
export const TabInfo: FC<TabInfoProps> = ({
|
|
title,
|
|
url,
|
|
favIconUrl,
|
|
onReload,
|
|
}) => {
|
|
const getInitial = (text: string): string => text.charAt(0).toUpperCase();
|
|
|
|
return (
|
|
<Card title="Current Tab">
|
|
<div className={styles.content}>
|
|
{favIconUrl ? (
|
|
<img src={favIconUrl} alt="" className={styles.favicon} />
|
|
) : (
|
|
<div className={styles.faviconPlaceholder}>{getInitial(title)}</div>
|
|
)}
|
|
<div className={styles.details}>
|
|
<p className={styles.title}>{title}</p>
|
|
<p className={styles.url}>{url}</p>
|
|
</div>
|
|
</div>
|
|
<Button variant="secondary" fullWidth onClick={onReload}>
|
|
Reload Tab
|
|
</Button>
|
|
</Card>
|
|
);
|
|
};
|