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 #94 from piotrzdziarski/1.3
1.3.0 improving stage indexes
- Loading branch information
Showing
101 changed files
with
1,764 additions
and
1,586 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { ifOnUpdateExistsHandleItForState } from "../../helpers/state/ifOnUpdateExistsHandleItForState"; | ||
import React, { useState } from 'react'; | ||
|
||
const SlideNumber = ( | ||
{ | ||
fsLightbox: { | ||
stageIndexes, | ||
data, | ||
componentsStates: { slide: slideState }, | ||
componentsStates: { | ||
slideNumberUpdater: slideNumberUpdaterState | ||
}, | ||
} | ||
} | ||
) => { | ||
const [slide, setSlide] = useState(data.slideOnLightboxOpen); | ||
slideState.get = () => slide; | ||
slideState.set = setSlide; | ||
const [slideNumberUpdater, setSlideNumberUpdater] = useState(false); | ||
slideNumberUpdaterState.get = () => slideNumberUpdater; | ||
slideNumberUpdaterState.set = setSlideNumberUpdater; | ||
|
||
useEffect(() => { | ||
if (data.slideOnLightboxOpen !== slide) data.slideOnLightboxOpen = slide; | ||
ifOnUpdateExistsHandleItForState(slideState); | ||
}, [slide]); | ||
|
||
if (data.totalSlides === 1) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="fslightbox-slide-number-container fslightbox-flex-centered"> | ||
<div>{ slide }</div> | ||
<div className="fslightbox-slash">/</div> | ||
<div>{ data.totalSlides }</div> | ||
</div> | ||
); | ||
}; | ||
|
||
SlideNumber.propTypes = { | ||
fsLightbox: PropTypes.object.isRequired | ||
return (data.sourcesCount === 1) ? | ||
null : | ||
( | ||
<div className="fslightbox-slide-number-container fslightbox-flex-centered"> | ||
<div>{ stageIndexes.current + 1 }</div> | ||
<div className="fslightbox-slash">/</div> | ||
<div>{ data.sourcesCount }</div> | ||
</div> | ||
); | ||
}; | ||
export default SlideNumber; | ||
export default SlideNumber; |
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
Oops, something went wrong.