-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c52f6b3
Showing
40 changed files
with
4,856 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** @type { import("eslint").Linter.Config } */ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:svelte/recommended', | ||
'prettier' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
extraFileExtensions: ['.svelte'] | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.svelte'], | ||
parser: 'svelte-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser' | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- gh-deploy | ||
|
||
jobs: | ||
build_site: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: build | ||
env: | ||
BASE_PATH: '/${{ github.event.repository.name }}' | ||
run: | | ||
npm run build | ||
- name: Upload Artifacts | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
# this should match the `pages` option in your adapter-static options | ||
path: 'build/' | ||
|
||
deploy: | ||
needs: build_site | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
steps: | ||
- name: Deploy | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"useTabs": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100, | ||
"plugins": ["prettier-plugin-svelte"], | ||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# svelte-swiper-cards | ||
|
||
Tinder-like swipeable cards for svelte. | ||
|
||
> [!NOTE] | ||
> In active development. Not ready for production. | ||
## Features | ||
|
||
- Built with tailwind | ||
- Reuses cards (only two cards, that are swapped) | ||
- Customizable (customize the card) | ||
- Modern: uses @use-gesture/vanilla for gesture handling | ||
- TypeScript | ||
|
||
## Installation | ||
|
||
- Copy `CardSwiper` folder from `src/libs` to your projects `lib` folder. | ||
|
||
- Install dependency | ||
|
||
```bash | ||
npm i @use-gesture/vanilla | ||
``` | ||
|
||
## Usage | ||
|
||
```svelte | ||
<script> | ||
import { CardSwiper } from '$lib/CardSwiper'; | ||
</script> | ||
<div class="h-screen w-screen"> | ||
<CardSwiper | ||
cardData={(index) => { | ||
return { | ||
title: 'Card ' + index, | ||
description: 'Description ' + index | ||
}; | ||
}} | ||
/> | ||
</div> | ||
``` | ||
|
||
### Customize | ||
|
||
Customize the `Card.svelte` file to your needs, if you need to pass in more data to your card, edit the `CardData` type in `CardSwiper/index.ts` (and add the prop to `Card.svelte`). | ||
|
||
### Programmatic control | ||
|
||
You can control the cards programmatically by calling the swipe function. | ||
|
||
```svelte | ||
<script> | ||
import { CardSwiper } from '$lib/CardSwiper'; | ||
let swipe: (direction?: 'left' | 'right') => void; | ||
</script> | ||
<div class="h-screen w-screen"> | ||
<CardSwiper | ||
cardData={(index) => { | ||
return { | ||
title: 'Card ' + index, | ||
description: 'Description ' + index | ||
}; | ||
}} | ||
bind:swipe | ||
/> | ||
<button on:click={() => swipe('left')}>Swipe left</button> | ||
<button on:click={() => swipe('right')}>Swipe right</button> | ||
</div> | ||
``` | ||
|
||
## Todo | ||
|
||
- Events | ||
- Examples | ||
- Refactor | ||
- Testing on multiple devices | ||
- Show optional overlay on cards when swiping | ||
|
||
## License | ||
|
||
MIT |
Oops, something went wrong.