Skip to content

Commit

Permalink
Misc types cleanup
Browse files Browse the repository at this point in the history
- exporting/importing `_EuiFlyoutSide` directly lets us skip the potential `undefined` type of the flyout prop
  • Loading branch information
cee-chen committed Aug 2, 2023
1 parent 0a1b43d commit ee4c1ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import { useEuiTheme } from '../../../services';
import { CommonProps } from '../../common';
import { EuiButtonIcon, EuiButtonIconPropsForButton } from '../../button';
import { useEuiI18n } from '../../i18n';
import { _EuiFlyoutSide } from '../../flyout/flyout';

import { EuiCollapsibleNavBetaProps } from '../';
import { euiCollapsibleNavButtonWrapperStyles } from './collapsible_nav_button.styles';

export type EuiCollapsibleNavButtonProps = CommonProps &
Partial<EuiButtonIconPropsForButton> & {
isCollapsed: boolean;
isSmallScreen: boolean;
side: EuiCollapsibleNavBetaProps['side'];
side: _EuiFlyoutSide;
};

export const EuiCollapsibleNavButton = forwardRef<
Expand All @@ -29,7 +29,7 @@ export const EuiCollapsibleNavButton = forwardRef<
>(({ isCollapsed, isSmallScreen, side, ...rest }, ref) => {
const euiTheme = useEuiTheme();
const styles = euiCollapsibleNavButtonWrapperStyles(euiTheme);
const cssStyles = [styles.euiCollapsibleNavButtonWrapper, styles[side!]];
const cssStyles = [styles.euiCollapsibleNavButtonWrapper, styles[side]];

let iconType: string;
if (isSmallScreen) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/flyout/flyout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const TYPES = ['push', 'overlay'] as const;
type _EuiFlyoutType = (typeof TYPES)[number];

export const SIDES = ['left', 'right'] as const;
type _EuiFlyoutSide = (typeof SIDES)[number];
export type _EuiFlyoutSide = (typeof SIDES)[number];

export const SIZES = ['s', 'm', 'l'] as const;
export type EuiFlyoutSize = (typeof SIZES)[number];
Expand Down

0 comments on commit ee4c1ed

Please sign in to comment.