Skip to content

Commit

Permalink
feat: add Carousel component (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
wp-aberg authored Mar 10, 2023
1 parent d53740d commit df0c3fc
Show file tree
Hide file tree
Showing 40 changed files with 2,117 additions and 300 deletions.
67 changes: 67 additions & 0 deletions build.washingtonpost.com/docs/components/carousel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Carousel
description: A component for cycling through elements.
component: carousel
status: "Draft"
---

## Options

### Basic

```jsx withPreview
export default function Example() {
const items = [
"Card 1 content",
"Card 2 content",
"Card 3 content",
"Card 4 content",
"Card 5 content",
"Card 6 content",
];
return (
<Box
css={{
paddingInline: "$100",
width: "100vw",
}}
>
<Carousel.Root itemsPerPage={1}>
<Carousel.Header>
<Carousel.HeaderContent>
<Carousel.Title>Carousel Title</Carousel.Title>
</Carousel.HeaderContent>
<Carousel.HeaderActions>
<Carousel.PreviousButton />
<Carousel.NextButton />
</Carousel.HeaderActions>
</Carousel.Header>
<Carousel.Content>
{items.map((item) => (
<Carousel.Item key={item}>
<Card
css={{
width: "200px",
height: "175px",
marginInlineEnd: "$025",
}}
>
{item}
</Card>
</Carousel.Item>
))}
</Carousel.Content>
<Carousel.Footer>
<Carousel.Dots />
</Carousel.Footer>
</Carousel.Root>
</Box>
);
}
```

---

## API Reference

<PropsTable props={propsTable} />
4 changes: 4 additions & 0 deletions build.washingtonpost.com/public/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<loc>https://build.washingtonpost.com/components/card</loc>
</url>

<url>
<loc>https://build.washingtonpost.com/components/carousel</loc>
</url>

<url>
<loc>https://build.washingtonpost.com/components/checkbox</loc>
</url>
Expand Down
130 changes: 99 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions ui/carousel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Carousel

```jsx
import { Carousel } from "@washingtonpost/wpds-ui-kit";

function Component() {
return <Carousel />;
}
```
57 changes: 57 additions & 0 deletions ui/carousel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@washingtonpost/wpds-carousel",
"version": "1.1.0",
"description": "WPDS Carousel",
"author": "WPDS Support <[email protected]>",
"homepage": "https://github.com/washingtonpost/wpds-ui-kit#readme",
"license": "MIT",
"source": "src/index.ts",
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"README.md",
"src"
],
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/washingtonpost/wpds-ui-kit.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1",
"build": "tsup src/index.ts --loader .ts=tsx --minify --format esm,cjs --dts --sourcemap --legacy-output --external react",
"dev": "tsup src/index.ts --format esm,cjs --watch --dts --legacy-output --external react",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"bugs": {
"url": "https://github.com/washingtonpost/wpds-ui-kit/issues"
},
"devDependencies": {
"tsup": "^5.11.13",
"typescript": "4.5.5"
},
"peerDependencies": {
"@washingtonpost/wpds-assets": "^1.17.0",
"@washingtonpost/wpds-button": "*",
"@washingtonpost/wpds-icon": "*",
"@washingtonpost/wpds-pagination-dots": "*",
"@washingtonpost/wpds-theme": "*",
"react": "^16.8.6 || ^17.0.2"
},
"dependencies": {
"@radix-ui/react-slot": "^1.0.0",
"@radix-ui/react-use-controllable-state": "^1.0.0",
"@washingtonpost/wpds-assets": "^1.17.0",
"@washingtonpost/wpds-button": "1.1.0",
"@washingtonpost/wpds-icon": "1.1.0",
"@washingtonpost/wpds-pagination-dots": "1.1.0",
"@washingtonpost/wpds-theme": "1.1.0",
"nanoid": "^3.3.4",
"react-swipeable": "^7.0.0"
}
}
Loading

2 comments on commit df0c3fc

@vercel
Copy link

@vercel vercel bot commented on df0c3fc Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit – ./build.washingtonpost.com

wpds-ui-kit.preview.now.washingtonpost.com
build.washingtonpost.com
wpds-ui-kit-git-main.preview.now.washingtonpost.com

@vercel
Copy link

@vercel vercel bot commented on df0c3fc Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

wpds-ui-kit-storybook – ./

wpds-ui-kit-storybook-git-main.preview.now.washingtonpost.com
wpds-ui-kit-storybook.preview.now.washingtonpost.com

Please sign in to comment.