diff --git a/news/40.feature b/news/40.feature new file mode 100644 index 0000000..63ac652 --- /dev/null +++ b/news/40.feature @@ -0,0 +1 @@ +Add conditionals around arrow and dot buttons, and hide them, if there is only one slide @danalvrz \ No newline at end of file diff --git a/src/components/View.jsx b/src/components/View.jsx index fecfe9a..4140224 100644 --- a/src/components/View.jsx +++ b/src/components/View.jsx @@ -110,7 +110,7 @@ const SliderView = (props) => { {data.slides?.length > 0 && ( <>
- {!data.hideArrows && ( + {!data.hideArrows && data.slides?.length > 1 && ( <> @@ -141,19 +141,20 @@ const SliderView = (props) => {
- -
- {scrollSnaps.map((_, index) => ( - scrollTo(index)} - className={'slider-dot'.concat( - index === selectedIndex ? ' slider-dot--selected' : '', - )} - /> - ))} -
+ {data.slides?.length > 1 && ( +
+ {scrollSnaps.map((_, index) => ( + scrollTo(index)} + className={'slider-dot'.concat( + index === selectedIndex ? ' slider-dot--selected' : '', + )} + /> + ))} +
+ )} )}