Skip to content

Commit

Permalink
Untangle Card and Popover styles
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Feb 24, 2021
1 parent b6ec840 commit 6005924
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
13 changes: 2 additions & 11 deletions packages/components/src/ui/card/body.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import { usePopoverContext } from '../popover';
import { Scrollable } from '../scrollable';
import { View } from '../view';
import * as styles from './styles';
Expand All @@ -27,17 +26,9 @@ function CardBody( props, forwardedRef ) {
'CardBody'
);

const { popover } = usePopoverContext();

const classes = useMemo(
() =>
cx(
styles.Body,
styles.borderRadius,
popover && styles.popoverBody,
className
),
[ className, popover ]
() => cx( styles.Body, styles.borderRadius, className ),
[ className ]
);

if ( scrollable ) {
Expand Down
4 changes: 0 additions & 4 deletions packages/components/src/ui/card/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export const rounded = css`
border-radius: ${ ui.get( 'cardBorderRadius' ) };
`;

export const popoverBody = css`
max-height: 80vh;
`;

export const small = css`
min-height: 30px;
`;
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/ui/popover/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ function PopoverContent( props, forwardedRef ) {
{ ...popover }
>
{ showContent && (
<Card elevation={ elevation } ref={ forwardedRef }>
<Card
className={ styles.cardStyle }
elevation={ elevation }
ref={ forwardedRef }
>
{ children }
</Card>
) }
Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/ui/popover/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ export const PopoverContent = css`
display: none;
}
`;

export const cardStyle = css`
${ ui.$( 'CardBody' ).getSelector() } {
max-height: 80vh;
}
`;

0 comments on commit 6005924

Please sign in to comment.