forked from umami-software/umami
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor components. Add refresh button.
- Loading branch information
Showing
12 changed files
with
85 additions
and
56 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
import Button from './Button'; | ||
import Refresh from 'assets/redo.svg'; | ||
|
||
export default function RefreshButton({ onClick }) { | ||
return <Button icon={<Refresh />} size="small" onClick={onClick} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
import React from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import PageHeader from 'components/layout/PageHeader'; | ||
import Link from 'components/common/Link'; | ||
import Button from 'components/common/Button'; | ||
import ActiveUsers from './ActiveUsers'; | ||
import Arrow from 'assets/arrow-right.svg'; | ||
import styles from './WebsiteHeader.module.css'; | ||
import RefreshButton from '../common/RefreshButton'; | ||
import ButtonLayout from '../layout/ButtonLayout'; | ||
|
||
export default function WebsiteHeader({ websiteId, name, showLink = false }) { | ||
export default function WebsiteHeader({ websiteId, title, showLink = false, onRefresh }) { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<PageHeader> | ||
{showLink ? ( | ||
<Link href="/website/[...id]" as={`/website/${websiteId}/${name}`} className={styles.title}> | ||
{name} | ||
</Link> | ||
) : ( | ||
<div className={styles.title}>{name}</div> | ||
)} | ||
<div className={styles.title}>{title}</div> | ||
<ActiveUsers className={styles.active} websiteId={websiteId} /> | ||
{showLink && ( | ||
<Button | ||
icon={<Arrow />} | ||
onClick={() => | ||
router.push('/website/[...id]', `/website/${websiteId}/${name}`, { | ||
shallow: true, | ||
}) | ||
} | ||
size="small" | ||
> | ||
<div>View details</div> | ||
</Button> | ||
)} | ||
<ButtonLayout> | ||
<RefreshButton onClick={onRefresh} /> | ||
{showLink && ( | ||
<Button | ||
icon={<Arrow />} | ||
onClick={() => | ||
router.push('/website/[...id]', `/website/${websiteId}/${name}`, { | ||
shallow: true, | ||
}) | ||
} | ||
size="small" | ||
> | ||
<div>View details</div> | ||
</Button> | ||
)} | ||
</ButtonLayout> | ||
</PageHeader> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters