Skip to content

Commit

Permalink
feat(carousel): draft carousel component
Browse files Browse the repository at this point in the history
  • Loading branch information
si3nloong committed Jun 1, 2021
1 parent ffa6d7c commit 4af3d42
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ You should choose whichever file format suitable for your use case.
## Component List

- [@responsive-ui/accordion](https://github.com/wetix/responsive-ui/tree/master/components/accordion)
- [@responsive-ui/app-bar](https://github.com/wetix/responsive-ui/tree/master/components/app-bar)
- [@responsive-ui/bottom-bar](https://github.com/wetix/responsive-ui/tree/master/components/bottom-bar)
- [@responsive-ui/bottom-modal](https://github.com/wetix/responsive-ui/tree/master/components/bottom-modal)
- [@responsive-ui/bottom-sheet](https://github.com/wetix/responsive-ui/tree/master/components/bottom-sheet)
- [@responsive-ui/button](https://github.com/wetix/responsive-ui/tree/master/components/button)
- [@responsive-ui/card](https://github.com/wetix/responsive-ui/tree/master/components/card)
- [@responsive-ui/carousel](https://github.com/wetix/responsive-ui/tree/master/components/carousel)
- [@responsive-ui/column](https://github.com/wetix/responsive-ui/tree/master/components/column)
- [@responsive-ui/dock](https://github.com/wetix/responsive-ui/tree/master/components/dock)
- [@responsive-ui/ellipsis](https://github.com/wetix/responsive-ui/tree/master/components/ellipsis)
Expand Down
40 changes: 40 additions & 0 deletions components/carousel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @responsive-ui/carousel

> An carousel component of responsive-ui.
<p>

[![Svelte v3](https://img.shields.io/badge/svelte-v3-orange.svg)](https://svelte.dev)
[![npm](https://img.shields.io/npm/v/@responsive-ui/carousel.svg)](https://www.npmjs.com/package/@responsive-ui/carousel)
[![Bundle Size](https://badgen.net/bundlephobia/minzip/%40responsive-ui%2Fcarousel)](https://bundlephobia.com/result?p=@responsive-ui/carousel)
[![download](https://img.shields.io/npm/dw/@responsive-ui/carousel.svg)](https://www.npmjs.com/package/@responsive-ui/carousel)
[![LICENCE](https://img.shields.io/github/license/wetix/responsive-ui)](https://github.com/wetix/responsive-ui/blob/master/LICENSE)

</p>

## Install

```console
npm install @responsive-ui/carousel
```

or

```console
yarn add @responsive-ui/carousel
```

## Sponsors

<img src="https://asset.wetix.my/images/logo/wetix.png" alt="WeTix" width="240px">

## License

[@responsive-ui/carousel](https://github.com/wetix/responsive-ui/tree/master/components/carousel) is 100% free and open-source, under the [MIT license](https://github.com/wetix/responsive-ui/blob/master/LICENSE).

## Big Thanks To

Thanks to these awesome companies for their support of Open Source developers ❤

[![GitHub](https://jstools.dev/img/badges/github.svg)](https://github.com/open-source)
[![NPM](https://jstools.dev/img/badges/npm.svg)](https://www.npmjs.com/)
48 changes: 48 additions & 0 deletions components/carousel/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "@responsive-ui/carousel",
"version": "1.0.3-alpha.0",
"description": "A carousel component of responsive-ui.",
"author": "Si3nLoong <sianloong90@gmail.com> (https://github.com/si3nloong)",
"homepage": "https://github.com/wetix/responsive-ui/blob/master/components/carousel#README.md",
"license": "MIT",
"main": "lib/cjs/index.js",
"browser": "lib/index.js",
"module": "lib/esm/index.js",
"unpkg": "lib/index.min.js",
"svelte": "src/Carousel.svelte",
"types": "types/index.d.ts",
"publishConfig": {
"access": "public"
},
"keywords": [
"svelte",
"ui-component",
"responsive-ui",
"carousel",
"svelte-carousel"
],
"peerDependencies": {
"svelte": "^3.27.0",
"svelte-preprocess": "^4.5.0",
"typescript": "^4.0.0"
},
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib",
"types",
"src"
],
"repository": {
"type": "git",
"url": "git+https://github.com/wetix/responsive-ui.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1"
},
"bugs": {
"url": "https://github.com/wetix/responsive-ui/issues"
}
}
19 changes: 19 additions & 0 deletions components/carousel/src/Carousel.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script lang="ts">
import type { CarouselItem } from "../types/index";
export let items: CarouselItem[] = [];
let offset = 0;
</script>

<div class="items" style="transform: translateX({offset}px);">
{#each items as item, i}
<div class="item" style="background-color: hsla({i * 25}deg, 75%, 55%);">
{item}
</div>
{/each}
</div>

<style lang="scss">
</style>
24 changes: 24 additions & 0 deletions components/carousel/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { SvelteComponentTyped } from "svelte/internal";

export type CarouselItem = {};

export interface CarouselProps {
class?: string;
compact?: boolean;
}

export interface CarouselEvents {
click?: WindowEventMap["click"];
}

export interface CarouselSlots {
default: {};
}

declare class Carousel extends SvelteComponentTyped<
CarouselProps,
CarouselEvents,
CarouselSlots
> {}

export default Carousel;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"jest": "^27.0.1",
"jest-transform-svelte": "^2.1.1",
"lerna": "^4.0.0",
"rollup": "^2.50.2",
"rollup": "^2.50.5",
"rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0",
"rollup-plugin-svelte": "^7.1.0",
Expand All @@ -65,14 +65,14 @@
"style-loader": "^2.0.0",
"svelte": "^3.38.2",
"svelte-check": "^2.0.0",
"svelte-jester": "^1.6.0",
"svelte-jester": "^1.7.0",
"svelte-jsx": "^2.0.0",
"svelte-loader": "^3.1.1",
"svelte-preprocess": "^4.7.3",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
"url-loader": "^4.1.1",
"vite": "^2.3.4"
"vite": "^2.3.5"
},
"jest": {
"transform": {
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
"noEmit": true,
"types": ["svelte", "node"]
},
"include": ["src", "components", "node_modules/@wetix/utils"],
"include": [
"src",
"components",
"node_modules/@wetix/animation",
"node_modules/@wetix/utils"
],
"extends": "@tsconfig/svelte/tsconfig.json",
"exclude": ["__sapper__/*"]
}

0 comments on commit 4af3d42

Please sign in to comment.