diff --git a/apps/native-ui-storybook/components/lab/Carousel/Carousel.docs.mdx b/apps/native-ui-storybook/components/lab/Carousel/Carousel.docs.mdx index 3e1acf417..3b1fe5217 100644 --- a/apps/native-ui-storybook/components/lab/Carousel/Carousel.docs.mdx +++ b/apps/native-ui-storybook/components/lab/Carousel/Carousel.docs.mdx @@ -14,6 +14,8 @@ import { BackToTopButton, DocComponentWrap } from '../../../docs/components'; The carousel is a component for presenting information in a manner for customers to scroll through. This is typically when you have multiple banners, or CTA's, etc, although there are many other functional use cases. - [Usage](#usage) + - [Basic Usage](#basic-usage) + - [Carousel with Pagination](#carousel-with-pagination) - [Props](#props) @@ -30,15 +32,39 @@ The carousel is a component for presenting information in a manner for customers ## Usage -> The `Carousel` component is to be used for presenting scrollable data +- The `Carousel` component is to be used for presenting scrollable data +- The `Carousel` scrolls horizontally only +- Most `Carousel` behaviour is predefined for a standardised behaviour and experience across apps +- Some props can be modified to offer customised behaviour -> The carousel scrolls horizontally only +## Basic Usage -> Most carousel behaviour is predefined for a standardised behaviour and experience across apps - -> Some props can be modified to offer customised behaviour - -A basic carousel implementation: + +
+ ( + + {item.title} + + )} + width={300} + /> +
+
```jsx import { Text } from '@utilitywarehouse/native-ui'; @@ -49,6 +75,71 @@ const MyComponent = () => { theme: { colors, radii, space }, } = useStyles(); + return ( + ( + + {item.title} + + )} + width={300} + /> + ); +}; +``` + +### Carousel with Pagination + +The `CarouselPagination` component is to be used in conjunction with the `Carousel` component + + +
+ ( +
+ {item.title} +
+ )} + width={300} + > + +
+
+
+ +```tsx +import { Text } from '@utilitywarehouse/native-ui'; +import { Box, Carousel, CarouselPagination } from '@utilitywarehouse/native-ui/lab'; + +const MyComponent = () => { return ( { }, ]} renderItem={({ item }) => ( - +
{item.title} - - )} +
+ )} width={300} - /> + > + +
); }; ``` @@ -95,4 +188,4 @@ The Carousel component accepts some props from the React Native `FlatList` compo | style? | StyleProp | - | Style applied to the carousel container | | width | number | - | Carousel viewport width | -For more information about any of the above props from the `FlatList` component, see the React Native FlatList [documentation](https://reactnative.dev/docs/flatlist). \ No newline at end of file +For more information about any of the above props from the `FlatList` component, see the React Native FlatList [documentation](https://reactnative.dev/docs/flatlist). diff --git a/apps/native-ui-storybook/docs/components/AllComponents.web.tsx b/apps/native-ui-storybook/docs/components/AllComponents.web.tsx index 760d71eb3..933c28834 100644 --- a/apps/native-ui-storybook/docs/components/AllComponents.web.tsx +++ b/apps/native-ui-storybook/docs/components/AllComponents.web.tsx @@ -27,7 +27,7 @@ import { Card, Switch, } from '@utilitywarehouse/native-ui'; -import { Actionsheet, Box } from '@utilitywarehouse/native-ui/lab'; +import { Actionsheet, Box, Carousel, CarouselPagination } from '@utilitywarehouse/native-ui/lab'; import { ElectricityMediumIcon, MobileMediumIcon, @@ -114,6 +114,37 @@ const AllComponents: React.FC = () => { + +
+ ( + + {item.title} + + )} + width={150} + > + + +
+