Skip to content

Commit

Permalink
Trying to convert to emotion
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Sep 20, 2022
1 parent 04e19f8 commit 87681b7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const KibanaPageTemplateInner: FC<Props> = ({
const kibanaChromeHeader = kibanaChrome.querySelector(
'[data-test-subj="headerGlobalNav"]'
) as HTMLElement;
setOffset(kibanaChromeHeader?.offsetHeight);
setOffset(kibanaChromeHeader?.offsetTop + kibanaChromeHeader?.offsetHeight);
}
}, []);

Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.kbnSolutionNav__sidebar {
overflow: hidden;

@include euiCanAnimate {
transition: min-width $euiAnimSpeedFast $euiAnimSlightResistance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
* Side Public License, v 1.
*/

import { EuiThemeAnimationSpeeds } from '@elastic/eui';
import { css } from '@emotion/react';

export const WithSolutionNavStyles = () => {
return {
overflow: 'hidden',
transition: `min-width ${EuiThemeAnimationSpeeds[1]} ${EuiThemeAnimationSpeeds[2]}`,
};
return css`
background: red;
`;
};
12 changes: 10 additions & 2 deletions packages/shared-ux/page/solution_nav/src/with_solution_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@

import React, { ComponentType, ReactNode, useState } from 'react';
import classNames from 'classnames';
import { SerializedStyles } from '@emotion/serialize';
import { css } from '@emotion/react';
import { useIsWithinBreakpoints, useEuiTheme } from '@elastic/eui';
import { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template-types';
import { SolutionNav, SolutionNavProps } from './solution_nav';
import './with_solution_nav.scss';

// https://reactjs.org/docs/higher-order-components.html#convention-wrap-the-display-name-for-easy-debugging
function getDisplayName(Component: ComponentType<any>) {
Expand Down Expand Up @@ -49,6 +52,7 @@ export const withSolutionNav = <P extends TemplateProps>(WrappedComponent: Compo
const { canBeCollapsed = true } = solutionNav;
const isSidebarShrunk =
isMediumBreakpoint || (canBeCollapsed && isLargerBreakpoint && !isSideNavOpenOnDesktop);
// const withSolutionNavStyles = WithSolutionNavStyles();
const sideBarClasses = classNames(
'kbnSolutionNav__sidebar',
'kbnStickyMenu',
Expand All @@ -66,11 +70,15 @@ export const withSolutionNav = <P extends TemplateProps>(WrappedComponent: Compo
/>
);

const pageSideBarProps: TemplateProps['pageSideBarProps'] = {
const pageSideBarProps: TemplateProps['pageSideBarProps'] & { css: SerializedStyles } = {
paddingSize: 'none' as 'none',
...props.pageSideBarProps,
minWidth: isSidebarShrunk ? euiTheme.size.xxl : undefined,
className: sideBarClasses,
className: '',
css: css`
background-color: red;
min-width: ${euiTheme.size.xxl};
`,
};

return (
Expand Down

0 comments on commit 87681b7

Please sign in to comment.