Enforce max width on mod card embeds (#3019)

Some gifs are too wide for the mod cards. Set
a max-width and force it on the media/iframe
so that it doesn't push out mod card controls.

CORL-1179
This commit is contained in:
Nick Funk
2020-07-16 16:18:02 +00:00
committed by GitHub
parent d43fbe357a
commit 6a5a18e3a4
2 changed files with 15 additions and 1 deletions
@@ -28,7 +28,13 @@ const GiphyMedia: FunctionComponent<Props> = ({
<div className={styles.embed}>
{!showAnimated && still && (
<BaseButton onClick={toggleImage} className={styles.toggle}>
<img src={still} className={styles.image} alt={title || ""} />
<img
src={still}
className={styles.image}
width={width || undefined}
height={height || undefined}
alt={title || ""}
/>
<Flex
direction="column"
alignItems="center"
@@ -47,8 +53,10 @@ const GiphyMedia: FunctionComponent<Props> = ({
{showAnimated && video && (
<BaseButton onClick={toggleImage}>
<video
className={styles.image}
width={width || undefined}
height={height || undefined}
title={title || ""}
autoPlay
loop
>
@@ -1,5 +1,10 @@
.embed {
margin: var(--spacing-2) 0;
max-width: 100%;
& > iframe {
max-width: 100%;
}
}
.toggle {
@@ -30,4 +35,5 @@
.image {
display: block;
max-width: 100%;
}