make primary title in header clickable

This commit is contained in:
Michael Fatemi 2021-07-13 19:57:27 -04:00
parent 171a82086f
commit c1f437cedd
2 changed files with 19 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import UIPrimaryTitle from '../UI/UIPrimaryTitle';
export default function Header() {
const me = useMe();
const notifications = useNotifications();
return (
<div
style={{
@ -18,7 +19,12 @@ export default function Header() {
alignItems: 'center',
}}
>
<UIPrimaryTitle>WheelShare</UIPrimaryTitle>
<UIPrimaryTitle
style={{ cursor: 'pointer' }}
onClick={() => (window.location.href = '/')}
>
WheelShare
</UIPrimaryTitle>
{me ? (
<>
{me.name}

View File

@ -1,11 +1,19 @@
import { CSSProperties, ReactNode } from 'react';
import { CSSProperties } from 'react';
const style: CSSProperties = {
const baseStyle: CSSProperties = {
fontSize: '3rem',
marginTop: '0.25em',
marginBottom: '0.25em',
};
export default function UIPrimaryTitle({ children }: { children: ReactNode }) {
return <h1 style={style}>{children}</h1>;
export default function UIPrimaryTitle({
children,
style,
...props
}: JSX.IntrinsicElements['h1']) {
return (
<h1 style={style ? { ...baseStyle, ...style } : baseStyle} {...props}>
{children}
</h1>
);
}