@@ -4,6 +4,8 @@ import {omit} from 'ramda';
44
55import RBCarousel from 'react-bootstrap/Carousel' ;
66
7+ import Link from '../../private/Link' ;
8+
79/**
810 * Component for creating Bootstrap carousel. This component is a slideshow
911 * for cycling through a series of content.
@@ -28,12 +30,15 @@ const Carousel = props => {
2830 ? item . imgClassName
2931 : 'd-block w-100' ;
3032
31- const additionalProps = item . href ? { href : item . href } : { } ;
33+ const useLink = item . href && true ;
34+ const additionalProps = useLink
35+ ? { href : item . href , external_link : item . external_link }
36+ : { } ;
3237
3338 return (
3439 < RBCarousel . Item
3540 key = { item . key }
36- as = { item . href ? 'a' : 'div' }
41+ as = { item . href ? Link : 'div' }
3742 { ...additionalProps }
3843 >
3944 < img
@@ -156,9 +161,21 @@ Carousel.propTypes = {
156161 */
157162 captionClassName : PropTypes . string ,
158163 /**
159- * Optional hyperlink to add to the item.
164+ * Optional hyperlink to add to the item. Item will be rendered as a
165+ * HTML <a> or as a Dash-style link depending on whether the link is
166+ * deemed to be internal or external. Override this automatic detection
167+ * with the external_link argument.
168+ */
169+ href : PropTypes . string ,
170+ /**
171+ * If true, the browser will treat this as an external link,
172+ * forcing a page refresh at the new location. If false,
173+ * this just changes the location without triggering a page
174+ * refresh. Use this if you are observing dcc.Location, for
175+ * instance. Defaults to true for absolute URLs and false
176+ * otherwise.
160177 */
161- href : PropTypes . string
178+ external_link : PropTypes . bool
162179 } )
163180 ) . isRequired ,
164181
0 commit comments