Skip to content

Commit

Permalink
Merge branch 'dev' into feature/GIVCAMP-313_vertical-poster-update
Browse files Browse the repository at this point in the history
* dev:
  1.3.5
  GIVCAMP-282 | React Player preview (light) (#216)
  • Loading branch information
yvonnetangsu committed Apr 6, 2024
2 parents 769fda2 + a5b97e9 commit 764974d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 10 deletions.
2 changes: 2 additions & 0 deletions components/EmbedMedia/EmbedMedia.styles.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export const mediaWrapper = '*:!w-full *:!h-full';
export const caption = '*:*:leading-display caption mt-1em max-w-prose-wide';
export const iconWrapper = 'size-50 sm:size-70 bg-black-true/70 border-3 rounded-full border-white group-hocus-within:scale-110 transition group-hocus-within:bg-digital-red';
export const previewIcon = 'text-white size-24 sm:size-30';
19 changes: 19 additions & 0 deletions components/EmbedMedia/EmbedMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { useEffect, useState } from 'react';
import { cnb } from 'cnbuilder';
import ReactPlayer from 'react-player/lazy';
import { Container } from '../Container';
import { FlexBox } from '../FlexBox';
import { WidthBox, type WidthType } from '../WidthBox';
import { HeroIcon } from '../HeroIcon';
import { type PaddingType } from '@/utilities/datasource';
import { type MediaAspectRatioType, mediaAspectRatios } from '@/utilities/datasource';
import * as styles from './EmbedMedia.styles';
Expand All @@ -16,8 +18,16 @@ type EmbedMediaProps = React.HTMLAttributes<HTMLDivElement> & {
spacingTop?: PaddingType;
spacingBottom?: PaddingType;
isCaptionInset?: boolean;
isPreview?: boolean;
previewAriaLabel?: string;
};

const PlayPreviewIcon = (
<FlexBox alignItems="center" justifyContent="center" className={styles.iconWrapper}>
<HeroIcon icon="play" noBaseStyle className={styles.previewIcon} />
</FlexBox>
);

export const EmbedMedia = ({
mediaUrl,
caption,
Expand All @@ -27,6 +37,8 @@ export const EmbedMedia = ({
spacingTop,
spacingBottom,
isCaptionInset,
isPreview,
previewAriaLabel,
className,
...props
}: EmbedMediaProps) => {
Expand Down Expand Up @@ -59,6 +71,13 @@ export const EmbedMedia = ({
height="100%"
url={mediaUrl}
controls
playsinline
light={isPreview ? true : false}
playing={isPreview ? true : false}
playIcon={isPreview ? PlayPreviewIcon : undefined}
// This previewAriaLabel prop is not documented but it is in the React Player source code
previewAriaLabel={isPreview ? previewAriaLabel : undefined}
className="group"
/>
)}
</div>
Expand Down
4 changes: 4 additions & 0 deletions components/FeaturedStories/FeatureMasonry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type FeatureMasonryProps = React.HTMLAttributes<HTMLDivElement> & {
imageFocus1?: string;
imageAlt1?: string;
videoUrl?: string;
previewAriaLabel?: string;
caption?: string;
}

Expand All @@ -34,6 +35,7 @@ export const FeatureMasonry = ({
imageFocus1,
imageAlt1,
videoUrl,
previewAriaLabel,
caption,
className,
...props
Expand Down Expand Up @@ -92,8 +94,10 @@ export const FeatureMasonry = ({
</div>
<EmbedMedia
mediaUrl={videoUrl}
isPreview
className="lg:col-span-6 bg-black-70"
aspectRatio="16x9"
previewAriaLabel={previewAriaLabel}
/>
</Grid>
<Text variant="caption" leading="display" className="text-black-70 max-w-prose-wide mt-1em whitespace-pre-line">
Expand Down
4 changes: 2 additions & 2 deletions components/HeroIcon/HeroIcon.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
XMarkIcon,
} from '@heroicons/react/24/outline';
import { CheckIcon } from '@heroicons/react/16/solid';
import { PlayIcon } from '@heroicons/react/24/solid';
import { PlayIcon } from '@heroicons/react/20/solid';

export const iconMap = {
action: ChevronRightIcon,
Expand Down Expand Up @@ -50,7 +50,7 @@ export const iconMap = {
minus: MinusIcon,
more: ArrowRightIcon,
pause: PauseCircleIcon,
play: PlayCircleIcon,
play: PlayIcon,
'play-outline': PlayCircleIcon,
plus: PlusIcon,
right: ArrowRightIcon,
Expand Down
6 changes: 6 additions & 0 deletions components/Storyblok/SbEmbedMedia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type SbEmbedMediaProps = {
spacingBottom?: PaddingType;
isCaptionInset?: boolean;
isCaptionLight?: boolean;
isPreview?: boolean;
previewAriaLabel?: string;
};
};

Expand All @@ -33,6 +35,8 @@ export const SbEmbedMedia = ({
spacingBottom,
isCaptionInset,
isCaptionLight,
isPreview,
previewAriaLabel = 'Play video',
},
blok,
}: SbEmbedMediaProps) => {
Expand All @@ -49,6 +53,8 @@ export const SbEmbedMedia = ({
spacingTop={spacingTop}
spacingBottom={spacingBottom}
isCaptionInset={isCaptionInset}
isPreview={isPreview}
previewAriaLabel={previewAriaLabel}
/>
);
};
3 changes: 3 additions & 0 deletions components/Storyblok/SbFeatureMasonry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type SbFeatureMasonryProps = {
image1?: SbImageType;
imageAlt1?: string;
videoUrl?: string;
previewAriaLabel?: string;
caption?: string;
};
};
Expand All @@ -25,6 +26,7 @@ export const SbFeatureMasonry = ({
image1: { filename: imageSrc1, focus: imageFocus1 } = {},
imageAlt1,
videoUrl,
previewAriaLabel = 'Play video',
caption,
},
blok,
Expand All @@ -41,6 +43,7 @@ export const SbFeatureMasonry = ({
imageFocus1={imageFocus1}
imageAlt1={imageAlt1}
videoUrl={videoUrl}
previewAriaLabel={previewAriaLabel}
caption={caption}
/>
);
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ood-giving-campaign",
"version": "1.3.4",
"version": "1.3.5",
"description": "Momentum",
"author": "Stanford University",
"keywords": [
Expand Down Expand Up @@ -40,7 +40,7 @@
"framer-motion": "^11.0.24",
"next": "13.4.9",
"react-loading-skeleton": "^3.3.1",
"react-player": "^2.14.1",
"react-player": "^2.15.1",
"storyblok-rich-text-react-renderer-ts": "^3.2.0",
"usehooks-ts": "^2.9.1"
},
Expand Down

0 comments on commit 764974d

Please sign in to comment.