Skip to content

Commit

Permalink
fix: plain prop
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Dec 8, 2020
1 parent 314f140 commit 82257b7
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ui/components/src/BlockContainer/BlockContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface BlockContainerOwnProps {
*/
'data-testid'?: string;
/**
* inner container variant. default to 'inner' to display a border and shadow
* inner container variant or plain
*/
plain?: boolean;
}
Expand All @@ -56,6 +56,11 @@ export const BlockContainer: FC<BlockContainerProps> = ({
}) => {
const [isOpen, setIsOpen] = useState(true);
const blockId = id !== '.' ? id : undefined || title;
const content = !plain ? (
<Box variant="blockcontainer.inner">{children}</Box>
) : (
children
);
return (
<Box variant="blockcontainer.container" {...rest}>
{(blockId || title || collapsible) && (
Expand Down Expand Up @@ -94,17 +99,9 @@ export const BlockContainer: FC<BlockContainerProps> = ({
)}
{description && <Description>{description}</Description>}
{collapsible ? (
<Collapsible isOpen={isOpen}>
{!plain ? (
<Box variant="blockcontainer.inner">{children}</Box>
) : (
children
)}
</Collapsible>
) : !plain ? (
<Box variant="blockcontainer.inner">{children}</Box>
<Collapsible isOpen={isOpen}>{content}</Collapsible>
) : (
children
content
)}
{!isOpen && <Divider />}
</Box>
Expand Down

0 comments on commit 82257b7

Please sign in to comment.