Skip to content

Commit

Permalink
Rename persistent item prop
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbissemattsson committed Jan 17, 2025
1 parent d735c49 commit aa15d70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/supersearch/src/lib/components/SuperSearch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
resultItem?: Snippet<
[ResultItem, (cellIndex: number) => string, (cellIndex: number) => boolean, number]
>;
leadingPersistentRow?: Snippet<[(cellIndex: number) => string, (cellIndex: number) => boolean]>;
persistentItem?: Snippet<[(cellIndex: number) => string, (cellIndex: number) => boolean]>;
defaultRow?: number;
toggleWithKeyboardShortcut?: boolean;
debouncedWait?: number;
Expand All @@ -62,7 +62,7 @@
closeAction: closeActionSnippet,
closeActionMediaQueryString = 'max-width: 640px', // defines when the back/close action should be visible (only shown when expanded)
resultItem = fallbackResultItem,
leadingPersistentRow,
persistentItem,
toggleWithKeyboardShortcut = false,
defaultRow = 0,
debouncedWait = 300
Expand Down Expand Up @@ -453,9 +453,9 @@
</div>
<nav class="supersearch-suggestions">
<div id={`${id}-grid`} role="grid">
{#if leadingPersistentRow}
{#if persistentItem}
<div role="row" class:focused={activeRowIndex === 0}>
{@render leadingPersistentRow(
{@render persistentItem(
(colIndex: number) => `${id}-result-item-0x${colIndex}`,
(colIndex: number) => activeRowIndex === 0 && colIndex === activeColIndex
)}
Expand All @@ -467,7 +467,7 @@
search.paginatedData.map((page) => page.items).flat()) ||
search.data?.items}
{#each resultItems as item, index}
{@const rowIndex = index + (leadingPersistentRow ? 1 : 0)}
{@const rowIndex = persistentItem ? index + 1 : index}
<div role="row" class:focused={activeRowIndex === rowIndex}>
{@render resultItem?.(
item,
Expand Down
2 changes: 1 addition & 1 deletion packages/supersearch/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<img src={clearIconSvg} width={16} height={16} alt="" />
</button>
{/snippet}
{#snippet leadingPersistentRow(getCellId, isFocusedCell)}
{#snippet persistentItem(getCellId, isFocusedCell)}
<div class="persistent-item" data-testid="persistent-item">
<a
href={`/test1#${getCellId(0)}`}
Expand Down

0 comments on commit aa15d70

Please sign in to comment.