diff --git a/src/components/Table/MagnifyingGlass.svelte b/src/components/Table/MagnifyingGlass.svelte
new file mode 100644
index 00000000..169c2393
--- /dev/null
+++ b/src/components/Table/MagnifyingGlass.svelte
@@ -0,0 +1,11 @@
+
diff --git a/src/components/Table/Search.svelte b/src/components/Table/Search.svelte
new file mode 100644
index 00000000..da41be80
--- /dev/null
+++ b/src/components/Table/Search.svelte
@@ -0,0 +1,85 @@
+
+
+
+
+
diff --git a/src/components/Table/Table.stories.svelte b/src/components/Table/Table.stories.svelte
index 76d6f609..f4796c92 100644
--- a/src/components/Table/Table.stories.svelte
+++ b/src/components/Table/Table.stories.svelte
@@ -99,8 +99,8 @@
{...withStoryDocs(searchDocs)}
args="{{
data: pressFreedom,
- paginated: true,
searchable: true,
+ paginated: true,
title: 'Press Freedom Index',
source:
"Source: Reporters Without Borders",
diff --git a/src/components/Table/Table.svelte b/src/components/Table/Table.svelte
index 39470635..c59cfe38 100644
--- a/src/components/Table/Table.svelte
+++ b/src/components/Table/Table.svelte
@@ -71,17 +71,11 @@
*/
export let searchable: boolean = false;
- /**
- * The label to place above the search box.
- * @type {string}
- */
- export let searchLabel: string;
-
/**
* The placeholder text that appears in the search box.
* @type {string}
*/
- export let searchPlaceholder: string;
+ export let searchPlaceholder: string = 'Search in table';
/**
* A field to offer uses as an interactive filter.
@@ -133,6 +127,7 @@
/** Import local helpers */
import Block from '../Block/Block.svelte';
import Pagination from './Pagination.svelte';
+ import Search from './Search.svelte';
import SortArrow from './SortArrow.svelte';
import {
filterArray,
@@ -174,7 +169,7 @@
}
function handleSearchInput(event) {
- searchText = event.target.value;
+ searchText = event.detail.value;
pageNumber = 1;
}
@@ -227,45 +222,6 @@
- {#if searchable || filterList}
-
- {/if}
truncateLength}"
>
- {#if title || dek}
+ {#if title || dek || searchable}
{#if title}
{@html title}
@@ -281,6 +237,37 @@
{#if dek}
{@html dek}
{/if}
+ {#if searchable || filterList}
+
+ {/if}
{/if}
@@ -456,12 +443,10 @@
}
section.input {
- margin: 16px 0;
- background-color: $tr-ultra-light-grey;
- padding: 0.75rem;
+ margin: 0.5rem 0 0 0;
+ padding: 0;
font-size: 1rem;
width: 100%;
- border: 1px solid $tr-light-muted-grey;
label {
line-height: 1.333;
display: block;
@@ -469,16 +454,6 @@
font-family: $font-family-display;
font-weight: 500;
}
- .search {
- .search--input {
- padding: 0.33rem;
- font-size: 1.1rem;
- height: 2.3rem;
- border: 1px solid $tr-muted-grey;
- border-radius: 5px;
- width: 300px;
- }
- }
.filter {
.filter--select {
padding: 0.33rem;
diff --git a/src/components/Table/X.svelte b/src/components/Table/X.svelte
new file mode 100644
index 00000000..2c0e3a7f
--- /dev/null
+++ b/src/components/Table/X.svelte
@@ -0,0 +1,20 @@
+
diff --git a/src/components/Table/stories/docs/search.md b/src/components/Table/stories/docs/search.md
index 55fbb053..aec6070f 100644
--- a/src/components/Table/stories/docs/search.md
+++ b/src/components/Table/stories/docs/search.md
@@ -1,10 +1,11 @@
-Allow users to search the table by setting the optional `searchable` variable to `true`.
+Allow users to search the table by setting the optional `searchable` variable. Modify the default text that appears in the box by supplying the `searchPlaceholder` option.
```svelte
Reporters Without Borders'},"
/>
```