Skip to content

Commit

Permalink
feat(SLB-284): add cta to Hero
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasimonato committed Apr 11, 2024
1 parent 184d6d5 commit fd0ab14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/ui/src/components/Organisms/PageHero.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Image, PageFragment } from '@custom/schema';
import { Image, Link, PageFragment } from '@custom/schema';
import React from 'react';

export function PageHero(props: NonNullable<PageFragment['hero']>) {
Expand Down Expand Up @@ -45,6 +45,16 @@ export function PageHero(props: NonNullable<PageFragment['hero']>) {
{props.lead ? (
<p className="mt-6 text-lg leading-8 text-gray-300">{props.lead}</p>
) : null}
{props.ctaText && props.ctaUrl ? (
<Link
href={props.ctaUrl}
className={
'mt-7 inline-block text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800'
}
>
{props.ctaText}
</Link>
) : null}
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/Routes/Page.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export const FullHero = {
source: image(Landscape, { width: 2000 }),
alt: 'Stock photo landscape hero.',
},
ctaUrl: '/test' as Url,
ctaText: 'Call to action',
},
},
},
Expand Down

0 comments on commit fd0ab14

Please sign in to comment.