Skip to content

Commit

Permalink
Add some minor touchups around the Unified Doc Viewer push flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
davismcphee committed Apr 10, 2024
1 parent 8b3d9f8 commit 1de9a94
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
keys,
EuiButtonEmpty,
useEuiTheme,
useIsWithinMinBreakpoint,
} from '@elastic/eui';
import type { Filter, Query, AggregateQuery } from '@kbn/es-query';
import type { DataTableRecord } from '@kbn/discover-utils/types';
Expand Down Expand Up @@ -82,7 +83,7 @@ export function DiscoverGridFlyout({
const services = useDiscoverServices();
const flyoutCustomization = useDiscoverCustomization('flyout');
const { euiTheme } = useEuiTheme();

const isXlScreen = useIsWithinMinBreakpoint('xl');
const defaultWidth = flyoutCustomization?.size ?? 540; // Give enough room to search bar to not wrap
const [flyoutWidth, setFlyoutWidth] = useLocalStorage(FLYOUT_WIDTH_KEY, defaultWidth);
const minWidth = euiTheme.base * 24;
Expand Down Expand Up @@ -230,6 +231,9 @@ export function DiscoverGridFlyout({
minWidth={minWidth}
maxWidth={maxWidth}
onResize={setFlyoutWidth}
css={{
maxWidth: `${isXlScreen ? `calc(100vw - ${defaultWidth}px)` : '90vw'} !important`,
}}
>
<EuiFlyoutHeader hasBorder>
<EuiFlexGroup
Expand Down Expand Up @@ -274,15 +278,11 @@ export function DiscoverGridFlyout({
</EuiFlyoutHeader>
<EuiFlyoutBody>{bodyContent}</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left">
{i18n.translate('discover.grid.flyout.close', {
defaultMessage: 'Close',
})}
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left">
{i18n.translate('discover.grid.flyout.close', {
defaultMessage: 'Close',
})}
</EuiButtonEmpty>
</EuiFlyoutFooter>
</EuiFlyoutResizable>
</EuiPortal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
const isMobileScreen = useIsWithinBreakpoints(['xs', 's']);
const isLargeScreen = dimensions?.width ? dimensions.width > euiTheme.base * 30 : false;
return (
<EuiFlexGroup ref={setRef}>
<EuiFlexItem>
<FlyoutActions
flyoutActions={flyoutActions}
isMobileScreen={isMobileScreen}
isLargeScreen={isLargeScreen}
/>
</EuiFlexItem>
</EuiFlexGroup>
<div ref={setRef}>
<FlyoutActions
flyoutActions={flyoutActions}
isMobileScreen={isMobileScreen}
isLargeScreen={isLargeScreen}
/>
</div>
);
}

Expand Down

0 comments on commit 1de9a94

Please sign in to comment.