diff --git a/js/views/toast_view.js b/js/views/toast_view.js index 9d4d0b6ea..cd8a96323 100644 --- a/js/views/toast_view.js +++ b/js/views/toast_view.js @@ -25,7 +25,7 @@ ) ); this.$el.show(); - setTimeout(this.close.bind(this), 2000); + setTimeout(this.close.bind(this), 2000000); }, }); diff --git a/stylesheets/_session.scss b/stylesheets/_session.scss index 40931f734..4bfb96dd5 100644 --- a/stylesheets/_session.scss +++ b/stylesheets/_session.scss @@ -60,11 +60,19 @@ $session-color-black: #000; $session-color-danger: #ff4538; $session-color-primary: $session-shade-13; $session-color-secondary: $session-shade-16; -$session-color-warning: $session-shade-17; + +$session-color-info: $session-shade-11; +$session-color-success: #35d388; +$session-color-error: #edd422; +$session-color-warning: #e54e45; $session-shadow-opacity: 0.15; $session-overlay-opacity: 0.3; +$session-margin-sm: 10px; +$session-margin-md: 15px; +$session-margin-lg: 20px; + @mixin session-color-subtle($color) { color: rgba($color, 0.6); } @@ -313,3 +321,82 @@ $session_message-container-border-radius: 5px; float: right; margin-top: 13.5px; } + +.session-toast { + position: fixed; + right: $session-margin-lg; + bottom: $session-margin-lg; + + padding: $session-margin-md $session-margin-md; + z-index: 100; + + background-color: rgba($session-shade-6, 0.8); + + display: flex; + flex-direction: row; + justify-content: flex-start; + + .toast-icon, + .toast-info { + display: flex; + flex-direction: column; + justify-content: center; + } + + .toast-icon { + padding-right: $session-icon-size-md; + } + .toast-info { + margin-right: $session-icon-size-sm + $session-icon-size-sm; + width: 350px; + + &-container { + display: block; + } + } + + .title, + .description { + white-space: nowrap; + text-overflow: ellipsis; + } + + .title { + font-size: 15px; + line-height: 13px; + margin-bottom: $session-margin-sm; + color: $session-color-white; + } + + .description { + font-size: 12px; + @include session-color-subtle($session-color-white); + } + + .toast-close { + @include session-color-subtle($session-color-white); + position: absolute; + top: $session-margin-md; + right: $session-margin-md; + + &:hover { + color: $session-color-white; + } + } + + @mixin set-toast-theme($color) { + border-left: 4px solid $color; + } + &.info { + @include set-toast-theme($session-color-info); + } + &.success { + @include set-toast-theme($session-color-success); + } + &.warning { + @include set-toast-theme($session-color-warning); + } + &.error { + @include set-toast-theme($session-color-error); + } +} diff --git a/ts/components/session/SessionButton.tsx b/ts/components/session/SessionButton.tsx index 587a7d522..894a58dcc 100644 --- a/ts/components/session/SessionButton.tsx +++ b/ts/components/session/SessionButton.tsx @@ -1,8 +1,6 @@ import React from 'react'; import classNames from 'classnames'; -//import { LocalizerType } from '../../types/Util'; - export enum SessionButtonType { Brand = 'brand', BrandOutline = 'brand-outline', @@ -23,7 +21,6 @@ export enum SessionButtonColor { } interface Props { - //i18n: LocalizerType; text: string; buttonType: SessionButtonType; buttonColor: SessionButtonColor; diff --git a/ts/components/session/SessionToast.tsx b/ts/components/session/SessionToast.tsx new file mode 100644 index 000000000..b461e3b06 --- /dev/null +++ b/ts/components/session/SessionToast.tsx @@ -0,0 +1,81 @@ +import React from 'react'; +import classNames from 'classnames'; + +import { + SessionIcon, + SessionIconButton, + SessionIconSize, + SessionIconType, +} from './icon/'; + +export enum SessionToastType { + Info = 'info', + Success = 'success', + Warning = 'warning', + Error = 'error', +} + +interface Props { + title: string; + description: string; + type: SessionToastType; +} + +export class SessionToast extends React.PureComponent { + public static defaultProps = { + description: '', + type: SessionToastType.Info, + }; + + constructor(props: any) { + super(props); + } + + public render() { + const { title, description, type } = this.props; + + let toastIcon; + switch (type) { + case SessionToastType.Info: + toastIcon = SessionIconType.Eye; + break; + case SessionToastType.Success: + toastIcon = SessionIconType.Check; + break; + case SessionToastType.Error: + toastIcon = SessionIconType.Search; + break; + case SessionToastType.Warning: + toastIcon = SessionIconType.Globe; + break; + default: + toastIcon = SessionIconType.Globe; + } + + return ( +
+
+ +
+
+
+

{title}

+

{description}

+
+
+ +
+ +
+
+ ); + } + + public closeToast() { + return; + } +}