Merge pull request #4613 from matrix-org/t3chguy/toasts1
Improve style of toasts to match Figma
This commit is contained in:
commit
c00fd326c5
3 changed files with 65 additions and 18 deletions
|
@ -28,8 +28,8 @@ limitations under the License.
|
||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
grid-row: 2 / 4;
|
grid-row: 2 / 4;
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
background-color: white;
|
background-color: $dark-panel-bg-color;
|
||||||
box-shadow: 0px 4px 12px $menu-box-shadow-color;
|
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,16 +37,15 @@ limitations under the License.
|
||||||
grid-row: 1 / 3;
|
grid-row: 1 / 3;
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
color: $primary-fg-color;
|
color: $primary-fg-color;
|
||||||
background-color: $primary-bg-color;
|
background-color: $dark-panel-bg-color;
|
||||||
box-shadow: 0px 4px 12px $menu-box-shadow-color;
|
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 20px 1fr;
|
grid-template-columns: 22px 1fr;
|
||||||
column-gap: 10px;
|
column-gap: 8px;
|
||||||
row-gap: 4px;
|
row-gap: 4px;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
padding-right: 16px;
|
|
||||||
|
|
||||||
&.mx_Toast_hasIcon {
|
&.mx_Toast_hasIcon {
|
||||||
&::after {
|
&::after {
|
||||||
|
@ -68,17 +67,45 @@ limitations under the License.
|
||||||
background-image: url("$(res)/img/e2e/warning.svg");
|
background-image: url("$(res)/img/e2e/warning.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
h2, .mx_Toast_body {
|
.mx_Toast_title, .mx_Toast_body {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&:not(.mx_Toast_hasIcon) {
|
||||||
|
padding-left: 12px;
|
||||||
|
|
||||||
h2 {
|
.mx_Toast_title {
|
||||||
grid-column: 1 / 3;
|
grid-column: 1 / -1;
|
||||||
grid-row: 1;
|
}
|
||||||
margin: 0;
|
}
|
||||||
font-size: $font-15px;
|
|
||||||
font-weight: 600;
|
.mx_Toast_title,
|
||||||
|
.mx_Toast_description {
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_Toast_title {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
grid-row: 1;
|
||||||
|
margin: 0;
|
||||||
|
font-size: $font-15px;
|
||||||
|
font-weight: 600;
|
||||||
|
display: inline;
|
||||||
|
width: auto;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding-left: 8px;
|
||||||
|
float: right;
|
||||||
|
font-size: $font-12px;
|
||||||
|
line-height: $font-22px;
|
||||||
|
color: $muted-fg-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Toast_body {
|
.mx_Toast_body {
|
||||||
|
@ -87,7 +114,13 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Toast_buttons {
|
.mx_Toast_buttons {
|
||||||
|
float: right;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
.mx_FormButton {
|
||||||
|
min-width: 96px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Toast_description {
|
.mx_Toast_description {
|
||||||
|
@ -96,6 +129,15 @@ limitations under the License.
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
margin: 4px 0 11px 0;
|
margin: 4px 0 11px 0;
|
||||||
font-size: $font-12px;
|
font-size: $font-12px;
|
||||||
|
|
||||||
|
.mx_AccessibleButton_kind_link {
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Toast_deviceID {
|
.mx_Toast_deviceID {
|
||||||
|
|
|
@ -15,7 +15,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { _t } from '../../languageHandler';
|
|
||||||
import ToastStore from "../../stores/ToastStore";
|
import ToastStore from "../../stores/ToastStore";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
|
@ -50,14 +49,21 @@ export default class ToastContainer extends React.Component {
|
||||||
"mx_Toast_hasIcon": icon,
|
"mx_Toast_hasIcon": icon,
|
||||||
[`mx_Toast_icon_${icon}`]: icon,
|
[`mx_Toast_icon_${icon}`]: icon,
|
||||||
});
|
});
|
||||||
const countIndicator = isStacked ? _t(" (1/%(totalCount)s)", {totalCount}) : null;
|
|
||||||
|
let countIndicator;
|
||||||
|
if (isStacked) {
|
||||||
|
countIndicator = `(1/${totalCount})`;
|
||||||
|
}
|
||||||
|
|
||||||
const toastProps = Object.assign({}, props, {
|
const toastProps = Object.assign({}, props, {
|
||||||
key,
|
key,
|
||||||
toastKey: key,
|
toastKey: key,
|
||||||
});
|
});
|
||||||
toast = (<div className={toastClasses}>
|
toast = (<div className={toastClasses}>
|
||||||
<h2>{title}{countIndicator}</h2>
|
<div className="mx_Toast_title">
|
||||||
|
<h2>{title}</h2>
|
||||||
|
<span>{countIndicator}</span>
|
||||||
|
</div>
|
||||||
<div className="mx_Toast_body">{React.createElement(component, toastProps)}</div>
|
<div className="mx_Toast_body">{React.createElement(component, toastProps)}</div>
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2083,7 +2083,6 @@
|
||||||
"Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.",
|
"Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.",
|
||||||
"Tried to load a specific point in this room's timeline, but was unable to find it.": "Tried to load a specific point in this room's timeline, but was unable to find it.",
|
"Tried to load a specific point in this room's timeline, but was unable to find it.": "Tried to load a specific point in this room's timeline, but was unable to find it.",
|
||||||
"Failed to load timeline position": "Failed to load timeline position",
|
"Failed to load timeline position": "Failed to load timeline position",
|
||||||
" (1/%(totalCount)s)": " (1/%(totalCount)s)",
|
|
||||||
"Guest": "Guest",
|
"Guest": "Guest",
|
||||||
"Your profile": "Your profile",
|
"Your profile": "Your profile",
|
||||||
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
|
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
|
||||||
|
|
Loading…
Reference in a new issue