Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Make the space between search bar and table rows match the compressed state of the search box #1393

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading