Skip to content

Commit

Permalink
style(media): change to arrow fns from function keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkrolick committed Jul 12, 2019
1 parent 9e6f93e commit 5acbafe
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
15 changes: 8 additions & 7 deletions src/components/media/Media.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ type Props = {
className?: string,
};

function Media({ as: Wrapper, children, className, ...rest }: Props) {
return (
<Wrapper className={classnames('bdl-Media', className)} {...rest}>
{children}
</Wrapper>
);
}
const Media = ({ as: Wrapper, children, className, ...rest }: Props) => (
<Wrapper className={classnames('bdl-Media', className)} {...rest}>
{children}
</Wrapper>
);

// Use this instead of default value because of param destructuring bug in Flow
// that affects union types
// https://github.com/facebook/flow/issues/5461
Media.defaultProps = {
as: 'div',
};
Expand Down
13 changes: 5 additions & 8 deletions src/components/media/MediaBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ type Props = {
className?: string,
};

function MediaBody(props: Props) {
const { className, children, ...rest } = props;
return (
<div className={classnames('bdl-Media-body', className)} {...rest}>
{children}
</div>
);
}
const MediaBody = ({ className, children, ...rest }: Props) => (
<div className={classnames('bdl-Media-body', className)} {...rest}>
{children}
</div>
);

export default MediaBody;
15 changes: 8 additions & 7 deletions src/components/media/MediaFigure.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ type Props = {
className?: string,
};

function MediaFigure({ as: Wrapper, className, children, ...rest }: Props) {
return (
<Wrapper className={classnames('bdl-Media-figure', className)} {...rest}>
{children}
</Wrapper>
);
}
const MediaFigure = ({ as: Wrapper, className, children, ...rest }: Props) => (
<Wrapper className={classnames('bdl-Media-figure', className)} {...rest}>
{children}
</Wrapper>
);

// Use this instead of default value because of param destructuring bug in Flow
// that affects union types
// https://github.com/facebook/flow/issues/5461
MediaFigure.defaultProps = {
as: 'figure',
};
Expand Down
22 changes: 10 additions & 12 deletions src/components/media/MediaMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ type Props = {
label?: string,
};

function MediaMenu({ className, children, isDisabled = false, label, ...rest }: Props) {
return (
<div className={classnames('bdl-Media-menu', className)} {...rest}>
<DropdownMenu constrainToScrollParent isRightAligned>
<PlainButton isDisabled={isDisabled} type="button" aria-label={label}>
<IconEllipsis color={bdlGray62} height={16} width={16} />
</PlainButton>
<Menu>{children}</Menu>
</DropdownMenu>
</div>
);
}
const MediaMenu = ({ className, children, isDisabled = false, label, ...rest }: Props) => (
<div className={classnames('bdl-Media-menu', className)} {...rest}>
<DropdownMenu constrainToScrollParent isRightAligned>
<PlainButton isDisabled={isDisabled} type="button" aria-label={label}>
<IconEllipsis color={bdlGray62} height={16} width={16} />
</PlainButton>
<Menu>{children}</Menu>
</DropdownMenu>
</div>
);

export default MediaMenu;

0 comments on commit 5acbafe

Please sign in to comment.