Skip to content

Commit

Permalink
Merge pull request #653 from WestpacGEL/hero-component-fix
Browse files Browse the repository at this point in the history
converted the hero component to be a server component
  • Loading branch information
samithaf authored Jan 16, 2024
2 parents 9c5315d + d8b3bfc commit 02ea2a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { HamburgerMenuIcon } from '@westpac/ui/icon';
import { type BrandKey } from '@westpac/ui/tailwind';
import throttle from 'lodash.throttle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
'use client';

import { Grid, GridItem } from '@westpac/ui';
import { AccessibilityPictogram, StopwatchPictogram, TruckPictogram } from '@westpac/ui/pictogram';
import { useSearchParams } from 'next/navigation';

import { Container } from '@/app/design-system/components';
import { type BrandKey } from '@/app/types/brand.types';

import { BackgroundImage, Header } from './components';
import { styles } from './hero.styles';

export function Hero() {
const searchParams = useSearchParams();
const brand = (searchParams.get('brand') ?? 'wbc') as BrandKey;
export function Hero({ brand }: { brand: BrandKey }) {
const { base, heading } = styles({ brand });
return (
<section className={base()}>
Expand Down
10 changes: 8 additions & 2 deletions apps/site/src/app/design-system/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Button, Grid, GridItem, Input } from '@westpac/ui';
import { GithubIcon } from '@westpac/ui/icon';
import Link from 'next/link';

import { BrandKey } from '@/app/types/brand.types';
import {
AtlassianLogo,
FacebookLogo,
Expand All @@ -17,10 +18,15 @@ import {

import { Hero, Section, SectionHeading, SectionItem } from './components';

export default function DesignSystemHomePage() {
export default function DesignSystemHomePage({
searchParams,
}: {
searchParams?: { [key: string]: string | undefined };
}) {
const brand = (searchParams?.brand || 'wbc') as BrandKey;
return (
<>
<Hero />
<Hero brand={brand} />
<Section>
<SectionHeading>Accessible by design</SectionHeading>
<Grid>
Expand Down

0 comments on commit 02ea2a2

Please sign in to comment.