1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
import React, { ReactElement } from 'react'; import { Title, Desc, StoryBookTitle, StoryBookDesc, ItemNews, StyledArrow } from '../styles'; import Carousel from './index'; export default { title: 'Examples', };
export const CarouselNewsExample = (): ReactElement => ( <> <StoryBookTitle>Exemple : Carousel for news</StoryBookTitle> <StoryBookDesc>#1</StoryBookDesc> <Carousel customPrevArrow={<StyledArrow prev />} customNextArrow={<StyledArrow next />} itemsToShow={1} space={0} dots={(isActive: boolean) => { return <p>[{isActive ? 'x': ''}]</p>; }} > <ItemNews style={{ backgroundImage: 'url(https://images.pexels.com/photos/414171/pexels-photo-414171.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500)', }} > <Title>Title 1</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews style={{ backgroundImage: 'url(https://images.pexels.com/photos/355465/pexels-photo-355465.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)', }} > <Title>Title 2</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews style={{ backgroundImage: 'url(https://images.pexels.com/photos/1034662/pexels-photo-1034662.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)', }} > <Title>Title 3</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews style={{ backgroundImage: 'url(https://images.pexels.com/photos/1776924/pexels-photo-1776924.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260)', }} > <Title>Title 4</Title> <Desc>Lorem ipsum</Desc> </ItemNews> </Carousel> <StoryBookDesc>#2 : With margin</StoryBookDesc> <Carousel itemsToShow={1} space={30}> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 1</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 2</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 3</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 4</Title> <Desc>Lorem ipsum</Desc> </ItemNews> </Carousel> </> );export const CarouselListExample = (): ReactElement => ( <> <StoryBookTitle>Exemple : Carousel for lists</StoryBookTitle> <StoryBookDesc> #1 : 'normal' mode, 4 items displayed in the same time (1 item for small screen, 2 items for medium screen) and 30px of space between items. </StoryBookDesc> <Carousel itemsToShow={1} space={30} responsive={[ { breakpoint: 700, itemsToShow: 4 }, { breakpoint: 400, itemsToShow: 2 }, ]} > <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 1</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 2</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 3</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 4</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 5</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 6</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 7</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 8</Title> <Desc>Lorem ipsum</Desc> </ItemNews> </Carousel> <StoryBookDesc> #2 : 'center' mode, width of 250px and space of 30px. The previous and next items are partially displayed. </StoryBookDesc> <Carousel space={30} mode="center" itemsWidth={250}> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 1</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 2</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 3</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 4</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 5</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 6</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 7</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 8</Title> <Desc>Lorem ipsum</Desc> </ItemNews> </Carousel> <StoryBookDesc> #3 : 'variableWidth' mode, width of 250px and space of 30px. That can show the next item every time. </StoryBookDesc> <Carousel space={30} mode="variableWidth" itemsWidth={250}> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 1</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 2</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 3</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 4</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #4e54c8, #8f94fb)' }}> <Title>Title 5</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #800080, #ffc0cb)' }}> <Title>Title 6</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #8e2de2, #4a00e0)' }}> <Title>Title 7</Title> <Desc>Lorem ipsum</Desc> </ItemNews> <ItemNews rounded style={{ backgroundImage: 'linear-gradient(to right, #fc4a1a, #f7b733)' }}> <Title>Title 8</Title> <Desc>Lorem ipsum</Desc> </ItemNews> </Carousel> </> );