diff --git a/packages/core/.lintstagedrc.yml b/packages/core/.lintstagedrc.yml index 4b7c3b9bb..2761bcc72 100644 --- a/packages/core/.lintstagedrc.yml +++ b/packages/core/.lintstagedrc.yml @@ -1,2 +1,2 @@ 'src/**/*.js': - - flow \ No newline at end of file + - flow focus-check \ No newline at end of file diff --git a/packages/core/src/components/Carousel/Carousel.css b/packages/core/src/components/Carousel/Carousel.css index 7f0ec2862..2506069bf 100644 --- a/packages/core/src/components/Carousel/Carousel.css +++ b/packages/core/src/components/Carousel/Carousel.css @@ -6,6 +6,14 @@ margin: 0 0 1.5rem 0; } +.title.large { + font-size: var(--fontsize-large-ii); +} + +.title.small { + font-size: var(--fontsize-large-i); +} + .controls { display: flex; justify-content: space-between; diff --git a/packages/core/src/components/Carousel/Carousel.js b/packages/core/src/components/Carousel/Carousel.js index 2d55d4530..8499d15e6 100644 --- a/packages/core/src/components/Carousel/Carousel.js +++ b/packages/core/src/components/Carousel/Carousel.js @@ -11,7 +11,7 @@ import css from './Carousel.css'; type Props = { children: Array, - title: string, + title?: string, slidesToShow: number, withoutControls: boolean, dragging: boolean, @@ -20,6 +20,7 @@ type Props = { accessibilityNextLabel: string, accessibilityPrevLabel: string, infinite?: boolean, + titleSize: 'small' | 'large' }; const Carousel = (props: Props) => { @@ -34,12 +35,16 @@ const Carousel = (props: Props) => { accessibilityNextLabel, accessibilityPrevLabel, infinite, + titleSize, } = props; const [slideIndex, setSlideIndex] = React.useState(0); const renderTopRightControls = () => (
-

{title}

+ { title &&

{title}

} {slidesToShow < children.length && (
, - title: string + title: string, + titleSize: 'small' | 'large' } -const MobileCarousel = ({ children, title }: Props) => { +const MobileCarousel = ({ children, title, titleSize }: Props) => { return (
-

{title}

+ { title &&

{title}

}
{children.map((slide) => (
@@ -27,6 +32,7 @@ const MobileCarousel = ({ children, title }: Props) => { MobileCarousel.defaultProps = { title: '', + titleSize: 'large', children: [] }; diff --git a/packages/playground/stories/Carousel.story.js b/packages/playground/stories/Carousel.story.js index 83228e249..e160bb835 100644 --- a/packages/playground/stories/Carousel.story.js +++ b/packages/playground/stories/Carousel.story.js @@ -35,6 +35,9 @@ storiesOf('Carousel', module) .add('With Title', () => ( {slides} )) +.add('With small Title', () => ( + {slides} +)) .add('With Center controls', () => ( {slides} )); diff --git a/packages/playground/stories/MobileCarousel.story.js b/packages/playground/stories/MobileCarousel.story.js index f0877847f..fcce50fd0 100644 --- a/packages/playground/stories/MobileCarousel.story.js +++ b/packages/playground/stories/MobileCarousel.story.js @@ -34,4 +34,7 @@ storiesOf('MobileCarousel', module) )) .add('With Title', () => ( {slides} +)) +.add('With small Title', () => ( + {slides} ));