mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
42 lines
1 KiB
TypeScript
42 lines
1 KiB
TypeScript
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
import { DEFAULT_HOME_PATH } from '../../../lib/navigations'
|
|
import { Box } from '../LayoutPrimitives'
|
|
export type OmnivoreLogoBaseProps = {
|
|
color?: string
|
|
href?: string
|
|
showTitle?: boolean
|
|
children: React.ReactNode
|
|
}
|
|
|
|
export function OmnivoreLogoBase(props: OmnivoreLogoBaseProps): JSX.Element {
|
|
const router = useRouter()
|
|
|
|
return (
|
|
<Box
|
|
style={{
|
|
textDecoration: 'none',
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
cursor: 'pointer',
|
|
}}
|
|
onClick={(event) => {
|
|
const navReturn = window.localStorage.getItem('nav-return')
|
|
if (navReturn) {
|
|
router.push(navReturn)
|
|
return
|
|
}
|
|
const query = window.sessionStorage.getItem('q')
|
|
if (query) {
|
|
router.push(`${DEFAULT_HOME_PATH}?${query}`)
|
|
} else {
|
|
router.push(DEFAULT_HOME_PATH)
|
|
}
|
|
}}
|
|
tabIndex={-1}
|
|
aria-label="Omnivore logo"
|
|
>
|
|
{props.children}
|
|
</Box>
|
|
)
|
|
}
|