mirror of
https://github.com/ansible/awx.git
synced 2026-02-19 20:20:06 -03:30
clean up responsive behavior of advanced search
This commit is contained in:
committed by
Shane McDonald
parent
397908543d
commit
8dc788dbcb
@@ -1,15 +1,17 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
ToolbarContent,
|
ToolbarContent as PFToolbarContent,
|
||||||
ToolbarGroup,
|
ToolbarGroup,
|
||||||
ToolbarItem,
|
ToolbarItem,
|
||||||
ToolbarToggleGroup,
|
ToolbarToggleGroup,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
DropdownPosition,
|
||||||
KebabToggle,
|
KebabToggle,
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import { SearchIcon } from '@patternfly/react-icons';
|
import { SearchIcon } from '@patternfly/react-icons';
|
||||||
@@ -19,6 +21,12 @@ import Sort from '../Sort';
|
|||||||
import { SearchColumns, SortColumns, QSConfig } from '../../types';
|
import { SearchColumns, SortColumns, QSConfig } from '../../types';
|
||||||
import { KebabifiedProvider } from '../../contexts/Kebabified';
|
import { KebabifiedProvider } from '../../contexts/Kebabified';
|
||||||
|
|
||||||
|
const ToolbarContent = styled(PFToolbarContent)`
|
||||||
|
& > .pf-c-toolbar__content-section {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
function DataListToolbar({
|
function DataListToolbar({
|
||||||
itemCount,
|
itemCount,
|
||||||
clearAllFilters,
|
clearAllFilters,
|
||||||
@@ -47,6 +55,11 @@ function DataListToolbar({
|
|||||||
const [isKebabModalOpen, setIsKebabModalOpen] = useState(false);
|
const [isKebabModalOpen, setIsKebabModalOpen] = useState(false);
|
||||||
const [isAdvancedSearchShown, setIsAdvancedSearchShown] = useState(false);
|
const [isAdvancedSearchShown, setIsAdvancedSearchShown] = useState(false);
|
||||||
|
|
||||||
|
const viewportWidth =
|
||||||
|
window.innerWidth || document.documentElement.clientWidth;
|
||||||
|
const dropdownPosition =
|
||||||
|
viewportWidth >= 992 ? DropdownPosition.right : DropdownPosition.left;
|
||||||
|
|
||||||
const onShowAdvancedSearch = shown => {
|
const onShowAdvancedSearch = shown => {
|
||||||
setIsAdvancedSearchShown(shown);
|
setIsAdvancedSearchShown(shown);
|
||||||
setIsKebabOpen(false);
|
setIsKebabOpen(false);
|
||||||
@@ -135,6 +148,7 @@ function DataListToolbar({
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
isOpen={isKebabOpen}
|
isOpen={isKebabOpen}
|
||||||
|
position={dropdownPosition}
|
||||||
isPlain
|
isPlain
|
||||||
dropdownItems={additionalControls}
|
dropdownItems={additionalControls}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ const AdvancedGroup = styled.div`
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: var(--pf-c-toolbar__expandable-content--m-expanded--GridRowGap);
|
grid-gap: var(--pf-c-toolbar__expandable-content--m-expanded--GridRowGap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& .pf-c-select {
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function AdvancedSearch({
|
function AdvancedSearch({
|
||||||
|
|||||||
Reference in New Issue
Block a user