Skip to content

Commit

Permalink
fix: add FiniteGrid, update prettier/readme
Browse files Browse the repository at this point in the history
  • Loading branch information
6eDesign committed Sep 21, 2021
1 parent 98efc35 commit e578881
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"svelteBracketNewLine": true
"svelteBracketNewLine": true,
"overrides": [
{
"files": "*.md",
"options": {
"useTabs": false
}
}
]
}
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ A small date picker built with Svelte 3. Demo available here: [view docs and exa
npm i -D svelte-calendar
```

## Features

- Day, Month & Year pickers
- Responsive
- Keyboard, touch, and scroll support
- Inline & Picker modes
- Virtual/infinite grid for animation performance
- Store-driven and extensible
- [Localization](https://6edesign.github.io/svelte-calendar) using `day.js`

## Usage within svelte-kit project

When using this component within a svelte-kit application it is necessary to add its two dependencies (`just-throttle` and `dayjs`) to the `config.kit.vite.optimizeDeps.include` array in `svelte.config.js`. Eg: your config should include the following:

```js
const config = {
kit: {
vite: {
optimizeDeps: {
include: ['just-throttle', 'dayjs']
}
}
}
kit: {
vite: {
optimizeDeps: {
include: ['just-throttle', 'dayjs']
}
}
}
};

export default config;
```

## Features

- Day, Month & Year pickers
- Responsive
- Keyboard, touch, and scroll support
- Inline & Picker modes
- Virtual/infinite grid for animation performance
- Store-driven and extensible
- [Localization](https://6edesign.github.io/svelte-calendar) using `day.js`

## Features In Development

- time picker
Expand Down
17 changes: 17 additions & 0 deletions src/lib/components/generic/FiniteGrid.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
import InfiniteGrid from './InfiniteGrid.svelte';
export let value;
export let values;
export let index = 0;
const cellCount = 1;
const get = (i) => ({ value: values[i] });
$: itemCount = values.length;
$: index = values.indexOf(value);
</script>

<InfiniteGrid {cellCount} {itemCount} {index} {get} let:value>
<slot {value} />
</InfiniteGrid>

0 comments on commit e578881

Please sign in to comment.