Skip to content

Commit

Permalink
Add optional icon to VideoPreviewImage (#2542)
Browse files Browse the repository at this point in the history
Add optional `icon` prop to VideoPreviewImage to enable adding a custom
icon.

---------

Co-authored-by: Julia Wegmayr <julia.wegmayr@vivid-planet.com>
  • Loading branch information
juliawegmayr and Julia Wegmayr authored Sep 18, 2024
1 parent 47f1ef9 commit 53d896b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-scissors-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-site": minor
---

Add optional `icon` prop to `VideoPreviewImage` to enable setting a custom play icon
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactNode } from "react";
import styled, { css } from "styled-components";

import { PixelImageBlockData } from "../../blocks.generated";
Expand All @@ -9,15 +10,14 @@ export interface VideoPreviewImageProps {
aspectRatio: string;
sizes?: string;
fill?: boolean;
icon?: ReactNode;
}

export const VideoPreviewImage = ({ onPlay, image, aspectRatio, sizes = "100vw", fill }: VideoPreviewImageProps) => {
export const VideoPreviewImage = ({ onPlay, image, aspectRatio, sizes = "100vw", fill, icon = <PlayIcon /> }: VideoPreviewImageProps) => {
return (
<Root $fill={fill}>
<PixelImageBlock data={image} aspectRatio={aspectRatio} sizes={sizes} fill={fill} />
<IconWrapper onClick={onPlay}>
<PlayIcon />
</IconWrapper>
<IconWrapper onClick={onPlay}>{icon}</IconWrapper>
</Root>
);
};
Expand Down

0 comments on commit 53d896b

Please sign in to comment.