-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW Add content for 'Add Block' popover widget
- Loading branch information
1 parent
a048cb1
commit 202ab8a
Showing
9 changed files
with
115 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
60 changes: 60 additions & 0 deletions
60
client/src/components/ElementEditor/AddElementPopoverContent.js
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* global window */ | ||
|
||
import React, { Component, PropTypes } from 'react'; | ||
import { Button } from 'reactstrap'; | ||
import classNames from 'classnames'; | ||
|
||
/** | ||
* The AddElementPopoverContent component used in the context of an ElementEditor shows the | ||
* available elements that can be added to an ElementalArea. | ||
*/ | ||
class AddElementPopoverContent extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.renderElementButtons = this.renderElementButtons.bind(this); | ||
} | ||
|
||
renderElementButtons() { | ||
const { elementTypes } = this.props; | ||
|
||
return elementTypes.map((elementType) => | ||
( | ||
<Button | ||
className={ | ||
classNames( | ||
elementType.icon, | ||
'btn--icon-xl', | ||
'element-editor-add-element-content__button' | ||
) | ||
} | ||
key={elementType.ID} | ||
> | ||
{elementType.title} | ||
</Button> | ||
) | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="element-editor-add-element-content"> | ||
<div className="element-editor-add-element-content__button-container"> | ||
{this.renderElementButtons()} | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
AddElementPopoverContent.propTypes = { | ||
elementTypes: PropTypes.arrayOf(PropTypes.shape({ | ||
title: PropTypes.string, | ||
icon: PropTypes.string, | ||
})), | ||
}; | ||
|
||
AddElementPopoverContent.defaultProps = { | ||
|
||
}; | ||
|
||
export default AddElementPopoverContent; |
43 changes: 43 additions & 0 deletions
43
client/src/components/ElementEditor/AddElementPopoverContent.scss
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.element-editor-add-element-content { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 300px; | ||
padding: 16px 20px 20px 20px; | ||
box-shadow: $z-depth-1; | ||
border-radius: $border-radius-sm; | ||
max-height: 500px; // Placeholder, value TBC | ||
overflow-y: scroll; | ||
|
||
&__button-container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
|
||
:nth-child(odd) { | ||
margin-right: 10px; | ||
} | ||
:nth-child(even) { | ||
margin-right: 0; | ||
} | ||
} | ||
|
||
&__button { | ||
min-width: calc(100% * (1 / 2) - 5px); | ||
padding: 7px 0 7px 2px; | ||
text-align: start; | ||
margin-bottom: 10px; | ||
|
||
&::before { | ||
margin-right: 12px; | ||
font-size: 2.3rem; | ||
|
||
} | ||
} | ||
|
||
// Adds necessary specificity to override default font-size | ||
& &__button::before { | ||
font-size: 2.3rem; | ||
} | ||
} | ||
|
||
|
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
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