Skip to content

Commit

Permalink
feat(story-embedded): show description text for embedded content
Browse files Browse the repository at this point in the history
  • Loading branch information
Immo-Be committed Feb 16, 2024
1 parent c98d596 commit ca4c617
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.embeddedContent
display: grid
grid-template-rows: auto 8em
border: 0
height: 100%
padding: emCalc(56px)

> iframe
height: 100%
width: 100%
border: 0

28 changes: 28 additions & 0 deletions src/scripts/components/stories/story-embedded/story-embedded.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, {FunctionComponent} from 'react';
import {EmbeddedItem} from '../../../types/gallery-item';

import styles from './story-embedded.module.styl';
import Caption from '../caption/caption';
import {ImageFit} from '../../../types/image-fit';

interface Props {
embeddedItem: EmbeddedItem;
}

const StoryEmbedded: FunctionComponent<Props> = ({embeddedItem}) => {
const {text} = embeddedItem;
return (
<div className={styles.embeddedContent}>
<iframe src={embeddedItem.embeddedSrc}></iframe>
{text && (
<Caption
showLightbox={false}
imageFit={ImageFit.Cover}
content={text}
/>
)}
</div>
);
};

export default StoryEmbedded;
5 changes: 0 additions & 5 deletions src/scripts/components/stories/story/story.module.styl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
.rightSideComponent
height: 100%

.embeddedContent
border: 0
height: 100%
padding: emCalc(56px)

.layerDescription
position: unset
padding-right: 0
Expand Down
7 changes: 2 additions & 5 deletions src/scripts/components/stories/story/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {GalleryItemType} from '../../../types/gallery-item';
import {useThunkDispatch} from '../../../hooks/use-thunk-dispatch';

import styles from './story.module.styl';
import StoryEmbedded from '../story-embedded/story-embedded';

const Story: FunctionComponent = () => {
const storyParams = useStoryParams();
Expand Down Expand Up @@ -97,11 +98,7 @@ const Story: FunctionComponent = () => {
case GalleryItemType.Globe:
return <StoryGlobe globeItem={item} />;
case GalleryItemType.Embedded:
return (
<iframe
className={styles.embeddedContent}
src={item.embeddedSrc}></iframe>
);
return <StoryEmbedded embeddedItem={item} />;
default:
console.warn(
// eslint-disable-next-line dot-notation
Expand Down
1 change: 1 addition & 0 deletions src/scripts/types/gallery-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface VideoItem {

export interface EmbeddedItem {
type: GalleryItemType.Embedded;
text?: string;
embeddedSrc?: string;
}

Expand Down

0 comments on commit ca4c617

Please sign in to comment.