Style notifications

This commit is contained in:
Pierre Burgy 2017-09-09 14:43:11 +02:00
parent 72e272d2df
commit 32efb51e0d
4 changed files with 66 additions and 46 deletions

View File

@ -16,22 +16,22 @@ class Notification extends React.Component { // eslint-disable-line react/prefer
options = { options = {
success: { success: {
icon: 'ion-ios-checkmark-outline', icon: 'fa-check',
title: 'Success', title: 'Success',
class: 'notificationSuccess', class: 'notificationSuccess',
}, },
warning: { warning: {
icon: 'ion-ios-information-outline', icon: 'fa-exclamation',
title: 'Warning', title: 'Warning',
class: 'notificationWarning', class: 'notificationWarning',
}, },
error: { error: {
icon: 'ion-ios-close-outline', icon: 'fa-exclamation',
title: 'Error', title: 'Error',
class: 'notificationError', class: 'notificationError',
}, },
info: { info: {
icon: 'ion-ios-information-outline', icon: 'fa-info',
title: 'Info', title: 'Info',
class: 'notificationInfo', class: 'notificationInfo',
}, },
@ -42,12 +42,11 @@ class Notification extends React.Component { // eslint-disable-line react/prefer
return ( return (
<li key={this.props.notification.id} className={`${styles.notification} ${styles[options.class]}`}> <li key={this.props.notification.id} className={`${styles.notification} ${styles[options.class]}`}>
<icon className={`ion ${options.icon} ${styles.notificationIcon}`}></icon> <icon className={`fa ${options.icon} ${styles.notificationIcon}`}></icon>
<p className={styles.notificationContent}> <div className={styles.notificationContent}>
<span className={styles.notificationTitle}>{options.title}: </span> <p className={styles.notificationTitle}><FormattedMessage id={this.props.notification.message} /></p>
<span><FormattedMessage id={this.props.notification.message} /></span> </div>
</p> <icon className={`fa fa-close ${styles.notificationClose}`} onClick={this.onCloseClicked}></icon>
<icon className={`ion ion-ios-close-empty pull-right ${styles.notificationClose}`} onClick={this.onCloseClicked}></icon>
</li> </li>
); );
} }

View File

@ -4,70 +4,69 @@
.notification { .notification {
position: relative; position: relative;
display: flex; display: flex;
width: 45rem; width: 28.6rem;
align-items: stretch; align-items: stretch;
background: #5fc2a3; background: $white;
margin-bottom: 1.4rem; margin-bottom: 1.4rem;
transition: box-shadow 0.2s ease; transition: all 0.2s ease;
border-radius: 0.1rem; border-radius: 0.1rem;
box-shadow: 0 2px 6px $gray-light; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
color: $white; color: #333740;
}
.notificationWarning {
background: $brand-warning;
}
.notificationError {
background: $brand-danger;
}
.notificationInfo {
background: $brand-info;
} }
.notification:hover { .notification:hover {
box-shadow: 0 1px 4px $gray-light; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
} }
.notificationIcon { .notificationIcon {
position: relative; position: relative;
display: block; display: block;
float: left;
width: 18%; width: 18%;
text-align: center; text-align: center;
font-size: 2.4rem; font-size: 2.4rem;
}
.notificationIcon:before { &:before {
position: absolute; position: absolute;
top: calc(50% - 1rem); top: calc(50% - 1rem);
left: calc(50% - 1rem); left: calc(50% - 1rem);
border-radius: 100%;
border: 1px solid $brand-success;
color: $brand-success;
height: 2rem;
width: 2rem;
font-size: 1.2rem;
padding-top: .3rem;
padding-left: 0.1rem;
text-align: center;
}
} }
.notificationContent { .notificationContent {
display: block; display: block;
float: left;
margin: 0; margin: 0;
padding-top: 1.4rem; padding-top: 1.5rem;
padding-bottom: 1.4rem; padding-bottom: 1.5rem;
padding-right: 1rem; padding-right: 1rem;
border-right: 1px solid rgba(255, 255, 255, 0.3); border-right: 1px solid rgba(255, 255, 255, 0.3);
width: 70%; width: 70%;
} }
.notificationTitle { .notificationTitle {
font-weight: bold; font-weight: 500;
font-size: 1.4rem;
margin-bottom: 0;
} }
.notificationClose { .notificationClose {
position: relative; position: relative;
display: block; display: block;
float: left;
cursor: pointer; cursor: pointer;
width: 12%; width: 12%;
opacity: 0.6; opacity: 0.6;
transition: opacity 0.1s ease; transition: opacity 0.1s ease;
font-size: 1.6rem;
color: #c2c4c7;
&:hover { &:hover {
opacity: 1; opacity: 1;
@ -75,8 +74,30 @@
&:before { &:before {
position: absolute; position: absolute;
top: calc(50% - 1.5rem); top: calc(50% - .9rem);
left: calc(50% - 0.5rem); left: calc(50% - 0.5rem);
font-size: 3rem; }
}
.notificationWarning {
.notificationIcon:before {
border-color: $brand-warning;
color: $brand-warning;
padding-top: .4rem;
}
}
.notificationError {
.notificationIcon:before {
border-color: $brand-danger;
color: $brand-danger;
padding-top: .4rem;
}
}
.notificationInfo {
.notificationIcon:before {
border-color: $brand-primary;
color: $brand-primary;
} }
} }

View File

@ -94,10 +94,10 @@
// Start with assigning color names to specific hex values. // Start with assigning color names to specific hex values.
$white: #fff !default; $white: #fff !default;
$black: #000 !default; $black: #000 !default;
$red: #d9534f !default; $red: #ff203c !default;
$orange: #f0ad4e !default; $orange: #ff5d00 !default;
$yellow: #ffd500 !default; $yellow: #ffd500 !default;
$green: #5cb85c !default; $green: #27b70f !default;
$blue: $strapi-blue !default; $blue: $strapi-blue !default;
$teal: #5bc0de !default; $teal: #5bc0de !default;
$pink: #ff5b77 !default; $pink: #ff5b77 !default;

View File

@ -9,7 +9,7 @@ $strapi-gray: #535F76;
$strapi-blue-darker: #18202E; $strapi-blue-darker: #18202E;
$strapi-blue-dark: #151C2E; $strapi-blue-dark: #151C2E;
$strapi-blue: #1C5DE7; $strapi-blue: #0097f7;
// - layout // - layout
// -- left menu // -- left menu