2020-08-18 09:51:32 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { useRouter } from 'next/router';
|
|
|
|
import PageHeader from 'components/layout/PageHeader';
|
|
|
|
import Button from 'components/common/Button';
|
|
|
|
import ActiveUsers from './ActiveUsers';
|
|
|
|
import Arrow from 'assets/arrow-right.svg';
|
|
|
|
import styles from './WebsiteHeader.module.css';
|
2020-08-31 12:53:39 +02:00
|
|
|
import RefreshButton from '../common/RefreshButton';
|
|
|
|
import ButtonLayout from '../layout/ButtonLayout';
|
2020-08-18 09:51:32 +02:00
|
|
|
|
2020-08-31 23:11:30 +02:00
|
|
|
export default function WebsiteHeader({ websiteId, title, showLink = false }) {
|
2020-08-18 09:51:32 +02:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PageHeader>
|
2020-08-31 12:53:39 +02:00
|
|
|
<div className={styles.title}>{title}</div>
|
2020-08-18 09:51:32 +02:00
|
|
|
<ActiveUsers className={styles.active} websiteId={websiteId} />
|
2020-08-31 12:53:39 +02:00
|
|
|
<ButtonLayout>
|
2020-08-31 23:11:30 +02:00
|
|
|
<RefreshButton websiteId={websiteId} />
|
2020-08-31 12:53:39 +02:00
|
|
|
{showLink && (
|
|
|
|
<Button
|
|
|
|
icon={<Arrow />}
|
|
|
|
onClick={() =>
|
2020-09-02 18:56:29 +02:00
|
|
|
router.push('/website/[...id]', `/website/${websiteId}/${title}`, {
|
2020-08-31 12:53:39 +02:00
|
|
|
shallow: true,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
size="small"
|
|
|
|
>
|
|
|
|
<div>View details</div>
|
|
|
|
</Button>
|
|
|
|
)}
|
|
|
|
</ButtonLayout>
|
2020-08-18 09:51:32 +02:00
|
|
|
</PageHeader>
|
|
|
|
);
|
|
|
|
}
|