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

[Canvas] Fix sharable runtime styles and remove color="ghost" where unnecessary #169313

Merged
merged 9 commits into from
Oct 24, 2023

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions x-pack/plugins/canvas/shareable_runtime/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import React, { FC } from 'react';
import { EuiProvider } from '@elastic/eui';
import { CanvasRenderedWorkpad, CanvasShareableState, Stage } from '../types';
import { RendererSpec } from '../../types';
import { initialCanvasShareableState, CanvasShareableStateProvider } from '../context';
Expand Down Expand Up @@ -43,8 +44,10 @@ export const App: FC<Props> = ({ workpad, stage }) => {
};

return (
<CanvasShareableStateProvider initialState={initialState}>
<Canvas />
</CanvasShareableStateProvider>
<EuiProvider>
<CanvasShareableStateProvider initialState={initialState}>
<Canvas />
</CanvasShareableStateProvider>
</EuiProvider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
position: absolute;
}

.bar {
composes: euiBottomBar from global;
}

:global .kbnCanvas :local .bar {
transition: bottom .25s;
padding: $euiSizeM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React, { FC } from 'react';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiBottomBar } from '@elastic/eui';
import { useCanvasShareableState } from '../../context';
import { Scrubber } from './scrubber';
import { Title } from './title';
Expand All @@ -33,24 +33,24 @@ export interface Props {
* The Footer of the Shareable Canvas Workpad.
*/
export const FooterComponent: FC<Props> = ({ isAutohide = false, isHidden = false }) => {
const { root, bar, title } = css;
const { root, title } = css;

return (
<div className={root} style={{ height: FOOTER_HEIGHT }}>
<Scrubber />
<div className={bar} style={{ bottom: isAutohide && isHidden ? -FOOTER_HEIGHT : 0 }}>
<EuiFlexGroup gutterSize="none">
<EuiBottomBar style={{ bottom: isAutohide && isHidden ? -FOOTER_HEIGHT : 0 }}>
<EuiFlexGroup gutterSize="none" responsive={false} wrap={true}>
<EuiFlexItem className={title}>
<Title />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="s">
<EuiFlexGroup gutterSize="m" responsive={false}>
<PageControls />
<Settings />
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</div>
</EuiBottomBar>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
*/

import React, { FC } from 'react';
import {
EuiFlexGroup,
EuiFlexItem,
EuiButtonIcon,
EuiButtonEmpty,
EuiText,
EuiThemeProvider,
} from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiButtonIcon, EuiButtonEmpty, EuiText } from '@elastic/eui';

import {
useCanvasShareableState,
Expand Down Expand Up @@ -59,43 +52,41 @@ export const PageControlsComponent: FC<Props> = ({
const currentPage = page + 1;

return (
<EuiThemeProvider colorMode="dark" wrapperProps={{ cloneElement: true }}>
<EuiFlexGroup alignItems="center" gutterSize="none" style={{ margin: '0 12px' }}>
<EuiFlexItem grow={false}>
<EuiButtonIcon
color="text"
data-test-subj="pageControlsPrevPage"
onClick={() => onSetPageNumber(page - 1)}
iconType="arrowLeft"
disabled={currentPage <= 1}
aria-label="Previous Page"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
color="text"
size="s"
onClick={onToggleScrubber}
data-test-subj="pageControlsCurrentPage"
>
<EuiText color="text" size="s">
Page {currentPage}
{totalPages > 1 ? ` of ${totalPages}` : null}
</EuiText>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
color="text"
data-test-subj="pageControlsNextPage"
onClick={() => onSetPageNumber(page + 1)}
iconType="arrowRight"
disabled={currentPage >= totalPages}
aria-label="Next Page"
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiThemeProvider>
<EuiFlexGroup alignItems="center" gutterSize="none" responsive={false}>
<EuiFlexItem grow={false}>
<EuiButtonIcon
color="text"
data-test-subj="pageControlsPrevPage"
onClick={() => onSetPageNumber(page - 1)}
iconType="arrowLeft"
disabled={currentPage <= 1}
aria-label="Previous Page"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
color="text"
size="s"
onClick={onToggleScrubber}
data-test-subj="pageControlsCurrentPage"
>
<EuiText color="text" size="s">
Page {currentPage}
{totalPages > 1 ? ` of ${totalPages}` : null}
</EuiText>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
color="text"
data-test-subj="pageControlsNextPage"
onClick={() => onSetPageNumber(page + 1)}
iconType="arrowRight"
disabled={currentPage >= totalPages}
aria-label="Next Page"
/>
</EuiFlexItem>
</EuiFlexGroup>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const SettingsComponent: FC<Props> = ({ refs }) => {
const [isPopoverOpen, setPopoverOpen] = useState(false);
const button = (
<EuiButtonIcon
color="ghost"
color="text"
iconType="gear"
aria-label="Settings"
onClick={() => setPopoverOpen(!isPopoverOpen)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {
* The title of the workpad displayed in the left-hand of the footer.
*/
export const TitleComponent: FC<Props> = ({ title }) => (
<EuiFlexGroup gutterSize="s" justifyContent="flexStart" alignItems="center">
<EuiFlexGroup gutterSize="s" justifyContent="flexStart" alignItems="center" responsive={false}>
<EuiFlexItem grow={false} style={{ flexShrink: 0 }}>
<EuiLink href="https://www.elastic.co" title="Powered by Elastic.co">
<EuiIcon type="logoElastic" size="l" />
Expand Down
Loading