Skip to content

Commit b0c66d8

Browse files
committed
fixed bugs
1 parent 58a0e18 commit b0c66d8

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/assets/scss/pages/story.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@
2222
.share-button {
2323
margin-right: 2em;
2424
}
25+
26+
.gallery-container {
27+
height: 34%;
28+
width: 34%;
29+
}

src/pages/Story.js

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,13 @@ const Story = (props) => {
9494
const hashtagsArray = ['EOS', 'userstory']
9595
const title = 'EOS User Story - POST Stories. GET Features.'
9696

97-
const displayImages = () => {
98-
const images = []
99-
for (let i = 0; i < 3; i++) {
100-
images.push({
101-
original: story.Attachment[`${i}`].url,
102-
thumbnail: story.Attachment[`${i}`].url
103-
})
104-
}
105-
return images
106-
}
107-
108-
const images = [].concat(displayImages())
97+
const images =
98+
story.Attachment?.map((attachment) => {
99+
return {
100+
original: attachment.url,
101+
thumbnail: attachment.url
102+
}
103+
}) ?? []
109104

110105
return (
111106
<>
@@ -238,13 +233,8 @@ const Story = (props) => {
238233
/>
239234
)}
240235
</div>
241-
<div>
242-
<ImageGallery
243-
items={images}
244-
showBullets={true}
245-
originalClass={'galleryoriginal'}
246-
thumbnailClass={'galleryThumbnail'}
247-
/>
236+
<div className='gallery-container'>
237+
<ImageGallery items={images} showBullets={true} />
248238
</div>
249239
<Comments storyId={storyId} />
250240
</div>

0 commit comments

Comments
 (0)