Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[error-center] Add icons and fix css version alpha #128

Merged
merged 1 commit into from
Jun 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions application/error-center/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var errorCenter = {
return {
source: window,
errors: [],
isErrorsVisible: false
isErrorsVisible: false,
numberDisplayed: 3
}
},
getInitialState(){
Expand All @@ -24,30 +25,26 @@ var errorCenter = {
_toggleVisible(){
this.setState({isErrorsVisible: !this.state.isErrorsVisible})
},
/** @inheriteddoc */
render() {
_renderErrors(){
return (
<div data-focus='error-center'>
<div data-focus='error-counter'>
{this.state.errors.length}
<i className="fa fa-times-circle"></i>{this.state.errors.length}
</div>
<div data-focus='error-actions'>
{
this.state.errors.length > 1
&&
<button className='btn btn-default' onClick={()=>{window.location.reload();}}>Reload</button>
}
{
this.state.errors.length > 1
&&
<button className='btn btn-default' onClick={this._toggleVisible}>{this.state.isErrorsVisible ? "Hide Errors":"Show Errors"}</button>
}
<i className='fa fa-refresh' onClick={()=>{window.location.reload();}}></i>
<i className={`fa fa-arrow-circle-o-${this.state.isErrorsVisible ? 'up' : 'down'}`} onClick={this._toggleVisible}></i>
<i className='fa fa-trash-o' onClick={()=>{this.setState({errors: []})}}></i>
</div>
<ul data-focus='error-stack'>
{this.state.isErrorsVisible ? this.state.errors.map((err)=>{return <li>{err}</li>}) : null}
{this.state.isErrorsVisible ? this.state.errors.slice(this.state.errors.length - this.props.numberDisplayed, this.state.errors.length).map((err)=>{return <li>{err}</li>}) : null}
</ul>
</div>
);
);
},
/** @inheriteddoc */
render() {
return this.state.errors.length > 0 ? this._renderErrors() : null;
}
};

Expand Down
37 changes: 36 additions & 1 deletion application/error-center/style/error-center.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,41 @@
z-index: 9999999;
max-width: 300px;
min-width: 200px;
background-color: red;
background-color: tomato;
color: white;
color: white;
div[data-focus='error-counter']{
font-weight: bold;
font-size: 3em;
text-align: center;
}
div[data-focus='error-actions']{
display: flex;
font-weight: bold;
font-size: 2em;
text-align: center;
/* Then we define how is distributed the remaining space */
justify-content: space-around;
}
ul[data-focus='error-stack']{
padding: 0;
margin: 0;
list-style: none;
display: flex;
justify-content: space-around;
flex-direction: row;
flex-wrap: wrap;
li{
background: transparent;
padding: 5px;
width: 300px;
height: 92px;
margin-top: 10px;
line-height: 20px;
color: white;
font-weight: bold;
font-size: 1em;
text-align: center;
}
}
}