mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
refactor(lib): extract fillArray utility
This commit is contained in:
parent
06e02c3dc3
commit
f3c702947c
7 changed files with 23 additions and 10 deletions
|
@ -21,11 +21,11 @@
|
|||
import CaretRight24 from 'carbon-icons-svelte/lib/CaretRight24';
|
||||
import CaretLeft24 from 'carbon-icons-svelte/lib/CaretLeft24';
|
||||
import Select, { SelectItem } from '../Select';
|
||||
import { cx } from '../../lib';
|
||||
import { cx, fillArray } from '../../lib';
|
||||
|
||||
const _class = cx('--pagination', className);
|
||||
$: totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
|
||||
$: selectItems = Array.from({ length: totalPages }, (_, i) => i);
|
||||
$: selectItems = fillArray(totalPages);
|
||||
$: backButtonDisabled = disabled || page === 1;
|
||||
$: _backButtonClass = cx(
|
||||
'--pagination__button',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue