Skip to content

Commit

Permalink
Merge pull request #1803 from aguescribano87/development
Browse files Browse the repository at this point in the history
TP-1277: Front img carousel
  • Loading branch information
bsabatino authored Apr 25, 2024
2 parents 34706d0 + b284fe2 commit 2abcee3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,4 @@



window['STORIES'] = [];</script><script src="runtime~main.087d072d.iframe.bundle.js"></script><script src="vendors~main.bed38707.iframe.bundle.js"></script><script src="main.ebc844bb.iframe.bundle.js"></script></body></html>
window['STORIES'] = [];</script><script src="runtime~main.087d072d.iframe.bundle.js"></script><script src="vendors~main.bed38707.iframe.bundle.js"></script><script src="main.5eff0b0f.iframe.bundle.js"></script></body></html>
3 changes: 3 additions & 0 deletions docs/main.5eff0b0f.iframe.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/main.5eff0b0f.iframe.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions docs/main.ebc844bb.iframe.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/main.ebc844bb.iframe.bundle.js.map

This file was deleted.

3 changes: 2 additions & 1 deletion packages/carousel/src/Carousel.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ export const CarouselComponent = () => {
'https://www.youtube.com/embed/70KXYjyzFK4',
]

const PLANO = ['https://www.krellbrokers.com/images/plano-2.png']
const PLANO = ['https://cedreo.com/wp-content/uploads/2023/10/ES_CASA-4-HABITACIONES_2D_GROUND-FLOOR-PLAN_624.png']

const Video360 = ['https://my.matterport.com/show/?m=eURj8Qwwzb2']

return (
<Box __css={{ width: '770px' }}>
<Carousel
frontCoverBlueprints="https://hips.hearstapps.com/hmg-prod/images/apartamento15-organizada-1528886170.jpg?crop=1.00xw:0.669xh;0,0.160xh&resize=640:*"
images={imgs}
video={VIDEO}
planos={PLANO}
Expand Down
31 changes: 23 additions & 8 deletions packages/carousel/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,28 @@ export const Carousel = ({
video = [],
video360 = [],
otherComponent = false,
frontCoverImg = false,
frontCoverBlueprints = false,
...props
}) => {
const Images = [...images, ...planos]
const [fullscreen, setFullscreen] = useState(false)
const [tabSelected, setTabSelected] = useState('fotos')
const tabContainers = []
const [index, setIndex] = useState(0)
const [contTab, setContTab] = useState(0)
const Images = [...images, ...planos]
const imgWithCover = [...images]
const bluePrintsWithCover = [...planos]

if (frontCoverImg) {
Images.unshift(frontCoverImg)
imgWithCover.unshift(frontCoverImg)
}

if (frontCoverBlueprints) {
Images.unshift(frontCoverBlueprints)
bluePrintsWithCover.unshift(frontCoverBlueprints)
}

const changeTabContainer = (tab) => {
setIndex(0)
Expand Down Expand Up @@ -122,9 +136,9 @@ export const Carousel = ({
if (tabSelected === 'videos') {
newContTab = video.length
} else if (tabSelected === 'fotos') {
newContTab = images.length
newContTab = imgWithCover.length
} else if (tabSelected === 'planos') {
newContTab = planos.length
newContTab = bluePrintsWithCover.length
} else if (tabSelected === 'video360') {
newContTab = video360.length
}
Expand Down Expand Up @@ -175,6 +189,7 @@ export const Carousel = ({
const closeFullscreen = () => {
setFullscreen(false)
setTabSelected('fotos')
setIndex(0)
}

return (
Expand Down Expand Up @@ -287,7 +302,7 @@ export const Carousel = ({
fontSize: '14px',
fontWeight: '700',
}}
>{`+${images.length - 3}`}</Box>
>{`+${Images.length - 3}`}</Box>
)}
</ImageCard>
</Box>
Expand Down Expand Up @@ -327,10 +342,10 @@ export const Carousel = ({
{tabSelected === 'fotos' && (
<Box className="fsTabCont">
<Box className="fsTabContImage">
<img src={images[index]} alt="Foto" />
<img src={imgWithCover[index]} alt="Foto" />
<Text className="contFotos" variant="bodyBold.fontSize14">{`${
index + 1
}/${images.length}`}</Text>
}/${imgWithCover.length}`}</Text>
</Box>
</Box>
)}
Expand All @@ -356,9 +371,9 @@ export const Carousel = ({
{tabSelected === 'planos' && (
<Box className="fsTabCont">
<Box className="fsTabContImage">
<img src={planos[index]} alt="Foto" />
<img src={bluePrintsWithCover[index]} alt="Foto" />
<Text variant="bodyBold.fontSize14">{`${index + 1}/${
planos.length
bluePrintsWithCover.length
}`}</Text>
</Box>
</Box>
Expand Down

0 comments on commit 2abcee3

Please sign in to comment.