Skip to content

Commit

Permalink
Added missing union type for EuiPageContent (#2516)
Browse files Browse the repository at this point in the history
* Added missing union type for EuiPageContent

* Renamed EuiPanelProps to take account its different types for EuiPageContent

* Added CHANGELOG entry & fixed Prettier formatting
  • Loading branch information
Drakota authored and chandlerprall committed Nov 13, 2019
1 parent f550549 commit bd0875e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Created `.euiTableCaption` with `position: relative` to avoid double border under header row ([#2484](https://github.com/elastic/eui/pull/2484))
- Fixed `EuiSwitch` to use `aria-labelledby` ([#2522](https://github.com/elastic/eui/pull/2522))
- Fixed `EuiPanelProps` type definition ([#2516](https://github.com/elastic/eui/pull/2516))

**Breaking changes**

Expand Down
12 changes: 5 additions & 7 deletions src/components/panel/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EuiBetaBadge } from '../badge/beta_badge';

export type PanelPaddingSize = 'none' | 's' | 'm' | 'l';

export interface EuiPanelProps extends CommonProps {
interface Props extends CommonProps {
/**
* If active, adds a deeper shadow to the panel
*/
Expand Down Expand Up @@ -45,14 +45,12 @@ export interface EuiPanelProps extends CommonProps {
}

interface Divlike
extends EuiPanelProps,
extends Props,
Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {}

interface Buttonlike
extends EuiPanelProps,
ButtonHTMLAttributes<HTMLButtonElement> {}
interface Buttonlike extends Props, ButtonHTMLAttributes<HTMLButtonElement> {}

type Props = ExclusiveUnion<Divlike, Buttonlike>;
export type EuiPanelProps = ExclusiveUnion<Divlike, Buttonlike>;

const paddingSizeToClassNameMap = {
none: null,
Expand All @@ -63,7 +61,7 @@ const paddingSizeToClassNameMap = {

export const SIZES = Object.keys(paddingSizeToClassNameMap);

export const EuiPanel: FunctionComponent<Props> = ({
export const EuiPanel: FunctionComponent<EuiPanelProps> = ({
children,
className,
paddingSize = 'm',
Expand Down

0 comments on commit bd0875e

Please sign in to comment.