Skip to content

Commit

Permalink
Make the space between search bar and table rows match the compressed…
Browse files Browse the repository at this point in the history
… state of the search box (#1391) (#1393)

Signed-off-by: Miki <miki@amazon.com>
(cherry picked from commit 82f35af)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 1353c20 commit 2bfa354
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src-docs/src/views/tables/in_memory/in_memory_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export const Table = () => {
const [incremental, setIncremental] = useState(false);
const [filters, setFilters] = useState(false);
const [contentBetween, setContentBetween] = useState(false);
const [compressed, setCompressed] = useState(false);
const [compressedSearch, setCompressedSearch] = useState(false);

const columns = [
{
Expand Down Expand Up @@ -95,6 +97,7 @@ export const Table = () => {
incremental: incremental,
schema: true,
},
compressed: compressedSearch,
filters: !filters
? undefined
: [
Expand Down Expand Up @@ -142,12 +145,27 @@ export const Table = () => {
onChange={() => setContentBetween(!contentBetween)}
/>
</OuiFlexItem>
<OuiFlexItem grow={false}>
<OuiSwitch
label="Compressed table"
checked={compressed}
onChange={() => setCompressed(!compressed)}
/>
</OuiFlexItem>
<OuiFlexItem grow={false}>
<OuiSwitch
label="Compressed search"
checked={compressedSearch}
onChange={() => setCompressedSearch(!compressedSearch)}
/>
</OuiFlexItem>
</OuiFlexGroup>
<OuiSpacer size="l" />
<OuiInMemoryTable
items={store.users}
columns={columns}
search={search}
compressed={compressed}
pagination={true}
sorting={true}
childrenBetween={
Expand Down
2 changes: 1 addition & 1 deletion src/components/basic_table/in_memory_table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export class OuiInMemoryTable<T> extends Component<
return (
<>
<OuiSearchBar onChange={this.onQueryChange} {...searchBarProps} />
<OuiSpacer size="l" />
<OuiSpacer size={searchBarProps.compressed ? 'm' : 'l'} />
</>
);
}
Expand Down

0 comments on commit 2bfa354

Please sign in to comment.