Skip to content

Commit

Permalink
Make outline optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaitanLyss committed Sep 4, 2024
1 parent ac9b042 commit f40020b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@selenite/commons",
"version": "0.24.1",
"version": "0.24.2",
"repository": "github:ShaitanLyss/selenite-commons",
"license": "MIT",
"keywords": [
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/MatchHighlighter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
content?: string;
ref?: string;
caseInsensitive?: boolean;
outline?: boolean;
}
let { content = '', ref = '', caseInsensitive = true }: Props = $props();
let { content = '', ref = '', caseInsensitive = true,outline = false }: Props = $props();
const parts = $derived(matchingParts(content, ref, { caseInsensitive }));
</script>

{#each parts as { match, part }}
{#if match}
<mark class="bg-accent text-accent-content outline-accent outline">{part}</mark>
<mark class="bg-accent text-accent-content" class:outline={outline} class:outline-accent={outline}>{part}</mark>
{:else}
{part}
{/if}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/match-highlight/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Trust was the first thing we lost that day"
onkeydown={(e) => e.key === 'Escape' && refInput?.blur()} />

{#each content.split('\n') as line}
<p class="italic text-lg"><MatchHighlighter content={line} {ref} /></p>
<p class="italic text-lg"><MatchHighlighter content={line} {ref} outline={true}/></p>
{/each}

0 comments on commit f40020b

Please sign in to comment.