-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhance BlockCOntainer with actions
- Loading branch information
1 parent
a83bab3
commit 59d19ed
Showing
4 changed files
with
117 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
import React, { FC } from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { ActionBar, ActionItem } from '../ActionBar'; | ||
|
||
const StyledBlockContainer = styled.div<{}>(() => ({ | ||
const SpacedBlockContainer = styled.div(() => ({ | ||
position: 'relative', | ||
margin: '25px 0 40px 0', | ||
})); | ||
|
||
const FramedBlockContainer = styled.div(() => ({ | ||
boxSadow: 'rgba(0, 0, 0, 0.1) 0px 1px 3px 0px', | ||
borderRadius: 4, | ||
border: '1px solid rgba(0, 0, 0, 0.1)', | ||
})); | ||
|
||
export const BlockContainer: FC = ({ children }) => ( | ||
<StyledBlockContainer> {children}</StyledBlockContainer> | ||
export interface BlockContainerProps { | ||
/** | ||
* additional actions provided to the component | ||
*/ | ||
actions?: ActionItem[]; | ||
} | ||
export const BlockContainer: FC<BlockContainerProps> = ({ | ||
children, | ||
actions, | ||
}) => ( | ||
<SpacedBlockContainer> | ||
<FramedBlockContainer>{children}</FramedBlockContainer> | ||
{actions && <ActionBar actionItems={actions} />} | ||
</SpacedBlockContainer> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters