[portal] enable customization of product logo

pull/460/head
Yangshun Tay 2 years ago
parent 27fb277a98
commit 9492cacecf

@ -108,6 +108,7 @@ export default function AppShell({ children }: Props) {
const currentProductNavigation: Readonly<{ const currentProductNavigation: Readonly<{
googleAnalyticsMeasurementID: string; googleAnalyticsMeasurementID: string;
logo?: React.ReactNode;
navigation: ProductNavigationItems; navigation: ProductNavigationItems;
showGlobalNav: boolean; showGlobalNav: boolean;
title: string; title: string;
@ -173,6 +174,7 @@ export default function AppShell({ children }: Props) {
<MobileNavigation <MobileNavigation
globalNavigationItems={GlobalNavigation} globalNavigationItems={GlobalNavigation}
isShown={mobileMenuOpen} isShown={mobileMenuOpen}
logo={currentProductNavigation.logo}
productNavigationItems={currentProductNavigation.navigation} productNavigationItems={currentProductNavigation.navigation}
productTitle={currentProductNavigation.title} productTitle={currentProductNavigation.title}
setIsShown={setMobileMenuOpen} setIsShown={setMobileMenuOpen}
@ -192,6 +194,7 @@ export default function AppShell({ children }: Props) {
<div className="flex flex-1 items-center"> <div className="flex flex-1 items-center">
<ProductNavigation <ProductNavigation
items={currentProductNavigation.navigation} items={currentProductNavigation.navigation}
logo={currentProductNavigation.logo}
title={currentProductNavigation.title} title={currentProductNavigation.title}
titleHref={currentProductNavigation.titleHref} titleHref={currentProductNavigation.titleHref}
/> />

@ -11,6 +11,7 @@ import type { ProductNavigationItems } from './ProductNavigation';
type Props = Readonly<{ type Props = Readonly<{
globalNavigationItems: GlobalNavigationItems; globalNavigationItems: GlobalNavigationItems;
isShown?: boolean; isShown?: boolean;
logo?: React.ReactNode;
productNavigationItems: ProductNavigationItems; productNavigationItems: ProductNavigationItems;
productTitle: string; productTitle: string;
setIsShown: (isShown: boolean) => void; setIsShown: (isShown: boolean) => void;
@ -19,6 +20,7 @@ type Props = Readonly<{
export default function MobileNavigation({ export default function MobileNavigation({
globalNavigationItems, globalNavigationItems,
isShown, isShown,
logo,
productNavigationItems, productNavigationItems,
productTitle, productTitle,
setIsShown, setIsShown,
@ -69,11 +71,13 @@ export default function MobileNavigation({
</Transition.Child> </Transition.Child>
<div className="flex flex-shrink-0 items-center px-4"> <div className="flex flex-shrink-0 items-center px-4">
<Link href="/"> <Link href="/">
<img {logo ?? (
alt="Tech Interview Handbook" <img
className="h-8 w-auto" alt="Tech Interview Handbook"
src="/logo.svg" className="h-8 w-auto"
/> src="/logo.svg"
/>
)}
</Link> </Link>
</div> </div>
<div className="mt-5 h-0 flex-1 overflow-y-auto px-2"> <div className="mt-5 h-0 flex-1 overflow-y-auto px-2">

@ -17,11 +17,17 @@ export type ProductNavigationItems = ReadonlyArray<NavigationItem>;
type Props = Readonly<{ type Props = Readonly<{
items: ProductNavigationItems; items: ProductNavigationItems;
logo?: React.ReactNode;
title: string; title: string;
titleHref: string; titleHref: string;
}>; }>;
export default function ProductNavigation({ items, title, titleHref }: Props) { export default function ProductNavigation({
items,
logo,
title,
titleHref,
}: Props) {
const router = useRouter(); const router = useRouter();
return ( return (
@ -29,13 +35,14 @@ export default function ProductNavigation({ items, title, titleHref }: Props) {
<Link <Link
className="hover:text-primary-700 flex items-center gap-2 text-base font-medium" className="hover:text-primary-700 flex items-center gap-2 text-base font-medium"
href={titleHref}> href={titleHref}>
{titleHref !== '/' && ( {titleHref !== '/' &&
<img (logo ?? (
alt="Tech Interview Handbook" <img
className="h-8 w-auto" alt="Tech Interview Handbook"
src="/logo.svg" className="h-8 w-auto"
/> src="/logo.svg"
)} />
))}
{title} {title}
</Link> </Link>
<div className="hidden h-full items-center space-x-8 md:flex"> <div className="hidden h-full items-center space-x-8 md:flex">

@ -1,3 +1,5 @@
import { CurrencyDollarIcon } from '@heroicons/react/24/outline';
import type { ProductNavigationItems } from '~/components/global/ProductNavigation'; import type { ProductNavigationItems } from '~/components/global/ProductNavigation';
const navigation: ProductNavigationItems = [ const navigation: ProductNavigationItems = [
@ -8,6 +10,12 @@ const navigation: ProductNavigationItems = [
const config = { const config = {
// TODO: Change this to your own GA4 measurement ID. // TODO: Change this to your own GA4 measurement ID.
googleAnalyticsMeasurementID: 'G-DBLZDQ2ZZN', googleAnalyticsMeasurementID: 'G-DBLZDQ2ZZN',
logo: (
<CurrencyDollarIcon
aria-label="Tech Interview Handbook Offers"
className="h-8 w-8"
/>
),
navigation, navigation,
showGlobalNav: false, showGlobalNav: false,
title: 'Tech Offers Repo', title: 'Tech Offers Repo',
Loading…
Cancel
Save