-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b424252
commit 9ad55e5
Showing
6 changed files
with
198 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,57 @@ | ||
import { Button, Flex } from '@pluralsh/design-system' | ||
import Link from 'next/link' | ||
|
||
import { type LargeImageComponentFragment } from '@src/generated/graphqlDirectus' | ||
|
||
export function LargeImage({ spacing }: LargeImageComponentFragment) { | ||
return <div>LargeImage</div> | ||
import { cn } from '../cn' | ||
import { Body2, OverlineLabel, Title1 } from '../Typography' | ||
|
||
import { getSpacingClassName } from './common' | ||
import { Multimedia } from './Multimedia' | ||
|
||
export function LargeImage({ | ||
spacing, | ||
overline, | ||
heading, | ||
body_text: bodyText, | ||
cta_text: ctaText, | ||
cta_url: ctaUrl, | ||
media_type: mediaType, | ||
image, | ||
video_url: videoUrl, | ||
form, | ||
}: LargeImageComponentFragment) { | ||
return ( | ||
<section className={cn(getSpacingClassName(spacing), 'mx-xxxxxxlarge')}> | ||
<Flex gap="xxxlarge"> | ||
<Multimedia | ||
mediaType={mediaType} | ||
image={image} | ||
videoUrl={videoUrl} | ||
form={form} | ||
/> | ||
<Flex | ||
flex={1} | ||
flexDirection="column" | ||
justifyContent="center" | ||
gap="medium" | ||
> | ||
{overline && <OverlineLabel>{overline}</OverlineLabel>} | ||
<Title1>{heading}</Title1> | ||
<Body2 $color="text-light">{bodyText}</Body2> | ||
{ctaText && ( | ||
<Button | ||
className="mt-medium w-fit" | ||
as={Link} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
href={ctaUrl} | ||
> | ||
{ctaText} | ||
</Button> | ||
)} | ||
</Flex> | ||
</Flex> | ||
</section> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { type ComponentProps } from 'react' | ||
|
||
import { Code } from '@pluralsh/design-system' | ||
|
||
import { getImageUrl } from '@src/consts/routes' | ||
import { type ImageFileFragment } from '@src/generated/graphqlDirectus' | ||
|
||
import { ImageAspectRatio } from '../AspectRatio' | ||
import Embed from '../Embed' | ||
|
||
export function Multimedia({ | ||
mediaType, | ||
image, | ||
videoUrl, | ||
form, | ||
aspectRatio = '16 / 10', | ||
...props | ||
}: { | ||
mediaType: Nullable<string> | ||
image: Nullable<ImageFileFragment> | ||
videoUrl: Nullable<string> | ||
form: Nullable<string> | ||
aspectRatio?: string | ||
} & ComponentProps<'div'>) { | ||
const imageUrl = getImageUrl(image) | ||
|
||
return ( | ||
<div | ||
className="m-auto flex-1" | ||
{...props} | ||
> | ||
{mediaType === 'image' ? ( | ||
imageUrl && ( | ||
<ImageAspectRatio | ||
$aspectRatio={aspectRatio} | ||
$url={imageUrl} | ||
/> | ||
) | ||
) : mediaType === 'video' ? ( | ||
<Embed | ||
aspectRatio={aspectRatio} | ||
url={videoUrl ?? ''} | ||
/> | ||
) : mediaType === 'form' ? ( | ||
<Code css={{ overflow: 'auto', maxHeight: '500px' }}>{form ?? ''}</Code> | ||
) : null} | ||
</div> | ||
) | ||
} |
Oops, something went wrong.