-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1336 from ubilabs/feat/story-mixed-content-gallery
feat(story): create mixed content gallery component
- Loading branch information
Showing
25 changed files
with
451 additions
and
250 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
76 changes: 0 additions & 76 deletions
76
src/scripts/components/stories/story-gallery-image/story-gallery-image.tsx
This file was deleted.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
src/scripts/components/stories/story-gallery-item/story-gallery-item.tsx
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,45 @@ | ||
import React, {FunctionComponent} from 'react'; | ||
import cx from 'classnames'; | ||
|
||
import styles from './story-gallery-item.module.styl'; | ||
|
||
interface Props { | ||
children: React.ReactNode[]; | ||
currentIndex: number; | ||
showLightbox: boolean; | ||
} | ||
|
||
const StoryGalleryItem: FunctionComponent<Props> = ({ | ||
children, | ||
currentIndex, | ||
showLightbox | ||
}) => { | ||
const containerWidthPercent = children.length * 100; | ||
// Width in percent of each gallery item | ||
const itemWidthPercent = 100 / children.length; | ||
const imgClasses = cx( | ||
styles.slider, | ||
showLightbox && styles.lightboxStoryGallery, | ||
children.length > 1 && styles.transition | ||
); | ||
|
||
return ( | ||
<div | ||
className={imgClasses} | ||
style={{ | ||
width: `${containerWidthPercent}%`, | ||
transform: `translateX(-${itemWidthPercent * currentIndex}%)` | ||
}}> | ||
{children.map((child, index) => ( | ||
<div | ||
className={styles.sliderItem} | ||
key={index} | ||
style={{width: `${itemWidthPercent}%`}}> | ||
<div className={styles.itemContainer}>{child}</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default StoryGalleryItem; |
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
41 changes: 41 additions & 0 deletions
41
src/scripts/components/stories/story-globe/story-globe.module.styl
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,41 @@ | ||
.globeContainer | ||
position: relative | ||
display: flex | ||
flex-direction: column | ||
height: 100% | ||
padding: 0 emCalc(50px) | ||
background-color: $plainBlack | ||
|
||
.layerDetails | ||
position: absolute | ||
right: 0 | ||
bottom: 0 | ||
left: 0 | ||
padding: inherit | ||
|
||
.storySlider | ||
position: unset | ||
padding: emCalc(40px) 0 | ||
background: none | ||
|
||
> div | ||
min-width: 25% | ||
width: 60% | ||
|
||
@media screen and (max-width: 1025px) | ||
.layerDetails | ||
height: inherit | ||
background: none | ||
pointer-events: none | ||
|
||
> * | ||
position: relative | ||
z-index: 1 | ||
pointer-events: all | ||
|
||
.storySlider | ||
position: absolute | ||
right: 0 | ||
bottom: 0 | ||
padding: emCalc(40px) 0 emCalc(20px) | ||
|
Oops, something went wrong.