зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635403 - Part 2: Place the unregister button in different locations depending on layout r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D75571
This commit is contained in:
Родитель
4612ac49b5
Коммит
c500bc4c2c
|
@ -2,28 +2,70 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The current layout of a registration is
|
||||||
|
*
|
||||||
|
* +------+----------------------+----------------+
|
||||||
|
* | Header - scope + timestamp | Unregister_btn |
|
||||||
|
* +------+----------------------+----------------|
|
||||||
|
* | worker 1 |
|
||||||
|
| worker 2 |
|
||||||
|
| ... |
|
||||||
|
+----------------------------------------------+
|
||||||
|
| Unregister btn |
|
||||||
|
+----------------------------------------------+
|
||||||
|
*/
|
||||||
|
|
||||||
.registration {
|
.registration {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
font-size: var(--body-10-font-size);
|
font-size: var(--body-10-font-size);
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
grid-template-rows: minmax(calc(var(--base-unit) * 6), auto) 1fr auto;
|
||||||
|
grid-column-gap: calc(4 * var(--base-unit));
|
||||||
|
grid-row-gap: calc(2 * var(--base-unit));
|
||||||
|
grid-template-areas: "header header-controls"
|
||||||
|
"workers workers"
|
||||||
|
"footer-controls footer-controls";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vertical layout */
|
||||||
|
@media(max-width: 700px) {
|
||||||
|
.registration__controls {
|
||||||
|
grid-area: footer-controls;
|
||||||
|
justify-self: end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wide layout */
|
||||||
|
@media(min-width: 701px) {
|
||||||
|
.registration__controls {
|
||||||
|
grid-area: header-controls;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The current layout of a registration header is
|
|
||||||
*
|
|
||||||
* +----------------------------+----------------+
|
|
||||||
* | Registration scope | Unregister_btn |
|
|
||||||
* +---+----------+-------------+----------------|
|
|
||||||
*/
|
|
||||||
.registration__header {
|
.registration__header {
|
||||||
|
grid-area: header;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-areas: "icon scope"
|
||||||
|
"timestamp timestamp";
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
/* make the row min height the same size of the Unregister button,
|
/* make the row min height the same size of the Unregister button,
|
||||||
so we avoid a shifting movement when the button is not displayed */
|
so we avoid a shifting movement when the button is not displayed */
|
||||||
grid-template-rows: minmax(calc(var(--base-unit) * 6), auto);
|
grid-template-rows: minmax(calc(var(--base-unit) * 6), auto);
|
||||||
grid-column-gap: calc(4 * var(--base-unit));
|
grid-column-gap: calc(var(--base-unit) * 2);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.registration__header::before {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(var(--base-unit) * 4);
|
||||||
|
height: calc(var(--base-unit) * 4);
|
||||||
|
content: "";
|
||||||
|
background-image: url(chrome://devtools/skin/images/debugging-workers.svg);
|
||||||
|
}
|
||||||
|
|
||||||
.registration__scope {
|
.registration__scope {
|
||||||
font-size: var(--title-10-font-size);
|
font-size: var(--title-10-font-size);
|
||||||
font-weight: var(--title-10-font-weight);
|
font-weight: var(--title-10-font-weight);
|
||||||
|
@ -31,30 +73,20 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
/* display flex to handle showing the icon with ::before */
|
grid-area: scope;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
column-gap: calc(var(--base-unit) * 2);
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.registration__scope::before {
|
|
||||||
display: inline-block;
|
|
||||||
width: calc(var(--base-unit) * 4);
|
|
||||||
height: calc(var(--base-unit) * 4);
|
|
||||||
content: "";
|
|
||||||
background-image: url(chrome://devtools/skin/images/debugging-workers.svg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.registration__updated-time {
|
.registration__updated-time {
|
||||||
color: var(--theme-text-color-alt);
|
color: var(--theme-text-color-alt);
|
||||||
|
grid-area: timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
.registration__workers {
|
.registration__workers {
|
||||||
|
grid-area: workers;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: calc(2 * var(--base-unit)) 0 0 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.registration__workers-item:not(:first-child) {
|
.registration__workers-item:not(:first-child) {
|
||||||
|
|
|
@ -16,10 +16,10 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
|
||||||
const {
|
const {
|
||||||
article,
|
article,
|
||||||
aside,
|
aside,
|
||||||
|
h2,
|
||||||
header,
|
header,
|
||||||
li,
|
li,
|
||||||
p,
|
p,
|
||||||
span,
|
|
||||||
time,
|
time,
|
||||||
ul,
|
ul,
|
||||||
} = require("devtools/client/shared/vendor/react-dom-factories");
|
} = require("devtools/client/shared/vendor/react-dom-factories");
|
||||||
|
@ -102,11 +102,11 @@ class Registration extends PureComponent {
|
||||||
$date: registration.lastUpdateTime / 1000,
|
$date: registration.lastUpdateTime / 1000,
|
||||||
time: time({ className: "js-sw-updated" }),
|
time: time({ className: "js-sw-updated" }),
|
||||||
},
|
},
|
||||||
span({ className: "registration__updated-time" })
|
p({ className: "registration__updated-time" })
|
||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const scope = span(
|
const scope = h2(
|
||||||
{
|
{
|
||||||
title: registration.scope,
|
title: registration.scope,
|
||||||
className: "registration__scope js-sw-scope",
|
className: "registration__scope js-sw-scope",
|
||||||
|
@ -118,12 +118,8 @@ class Registration extends PureComponent {
|
||||||
{ className: className ? className : "" },
|
{ className: className ? className : "" },
|
||||||
article(
|
article(
|
||||||
{ className: "registration js-sw-container" },
|
{ className: "registration js-sw-container" },
|
||||||
header(
|
header({ className: "registration__header" }, scope, lastUpdated),
|
||||||
{ className: "registration__header" },
|
aside({ className: "registration__controls" }, unregisterButton),
|
||||||
scope,
|
|
||||||
aside({}, unregisterButton)
|
|
||||||
),
|
|
||||||
lastUpdated ? p({}, lastUpdated) : null,
|
|
||||||
// render list of workers
|
// render list of workers
|
||||||
ul(
|
ul(
|
||||||
{ className: "registration__workers" },
|
{ className: "registration__workers" },
|
||||||
|
|
|
@ -33,7 +33,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.worker__data > * {
|
.worker__data > * {
|
||||||
margin: calc(var(--base-unit) * 2) 0 0 0;
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* skip the first <dt> + <dd> pair elements */
|
||||||
|
.worker__data > *:nth-child(n + 3) {
|
||||||
|
margin-block-start: calc(var(--base-unit) * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.worker__link-start,
|
.worker__link-start,
|
||||||
|
|
|
@ -10,23 +10,25 @@ exports[`Registration Renders the expected snapshot for a registration with a wo
|
||||||
<header
|
<header
|
||||||
className="registration__header"
|
className="registration__header"
|
||||||
>
|
>
|
||||||
<span
|
<h2
|
||||||
className="registration__scope js-sw-scope"
|
className="registration__scope js-sw-scope"
|
||||||
title="SCOPE 123"
|
title="SCOPE 123"
|
||||||
>
|
>
|
||||||
SCOPE 123
|
SCOPE 123
|
||||||
</span>
|
</h2>
|
||||||
<aside>
|
|
||||||
<Localized
|
|
||||||
id="serviceworker-worker-unregister"
|
|
||||||
>
|
|
||||||
<UIButton
|
|
||||||
className="js-unregister-button"
|
|
||||||
onClick={[Function]}
|
|
||||||
/>
|
|
||||||
</Localized>
|
|
||||||
</aside>
|
|
||||||
</header>
|
</header>
|
||||||
|
<aside
|
||||||
|
className="registration__controls"
|
||||||
|
>
|
||||||
|
<Localized
|
||||||
|
id="serviceworker-worker-unregister"
|
||||||
|
>
|
||||||
|
<UIButton
|
||||||
|
className="js-unregister-button"
|
||||||
|
onClick={[Function]}
|
||||||
|
/>
|
||||||
|
</Localized>
|
||||||
|
</aside>
|
||||||
<ul
|
<ul
|
||||||
className="registration__workers"
|
className="registration__workers"
|
||||||
>
|
>
|
||||||
|
@ -62,23 +64,25 @@ exports[`Registration Renders the expected snapshot for a registration with mult
|
||||||
<header
|
<header
|
||||||
className="registration__header"
|
className="registration__header"
|
||||||
>
|
>
|
||||||
<span
|
<h2
|
||||||
className="registration__scope js-sw-scope"
|
className="registration__scope js-sw-scope"
|
||||||
title="SCOPE 123"
|
title="SCOPE 123"
|
||||||
>
|
>
|
||||||
SCOPE 123
|
SCOPE 123
|
||||||
</span>
|
</h2>
|
||||||
<aside>
|
|
||||||
<Localized
|
|
||||||
id="serviceworker-worker-unregister"
|
|
||||||
>
|
|
||||||
<UIButton
|
|
||||||
className="js-unregister-button"
|
|
||||||
onClick={[Function]}
|
|
||||||
/>
|
|
||||||
</Localized>
|
|
||||||
</aside>
|
|
||||||
</header>
|
</header>
|
||||||
|
<aside
|
||||||
|
className="registration__controls"
|
||||||
|
>
|
||||||
|
<Localized
|
||||||
|
id="serviceworker-worker-unregister"
|
||||||
|
>
|
||||||
|
<UIButton
|
||||||
|
className="js-unregister-button"
|
||||||
|
onClick={[Function]}
|
||||||
|
/>
|
||||||
|
</Localized>
|
||||||
|
</aside>
|
||||||
<ul
|
<ul
|
||||||
className="registration__workers"
|
className="registration__workers"
|
||||||
>
|
>
|
||||||
|
@ -131,23 +135,25 @@ exports[`Registration Renders the expected snapshot when sw debugging is disable
|
||||||
<header
|
<header
|
||||||
className="registration__header"
|
className="registration__header"
|
||||||
>
|
>
|
||||||
<span
|
<h2
|
||||||
className="registration__scope js-sw-scope"
|
className="registration__scope js-sw-scope"
|
||||||
title="SCOPE 123"
|
title="SCOPE 123"
|
||||||
>
|
>
|
||||||
SCOPE 123
|
SCOPE 123
|
||||||
</span>
|
</h2>
|
||||||
<aside>
|
|
||||||
<Localized
|
|
||||||
id="serviceworker-worker-unregister"
|
|
||||||
>
|
|
||||||
<UIButton
|
|
||||||
className="js-unregister-button"
|
|
||||||
onClick={[Function]}
|
|
||||||
/>
|
|
||||||
</Localized>
|
|
||||||
</aside>
|
|
||||||
</header>
|
</header>
|
||||||
|
<aside
|
||||||
|
className="registration__controls"
|
||||||
|
>
|
||||||
|
<Localized
|
||||||
|
id="serviceworker-worker-unregister"
|
||||||
|
>
|
||||||
|
<UIButton
|
||||||
|
className="js-unregister-button"
|
||||||
|
onClick={[Function]}
|
||||||
|
/>
|
||||||
|
</Localized>
|
||||||
|
</aside>
|
||||||
<ul
|
<ul
|
||||||
className="registration__workers"
|
className="registration__workers"
|
||||||
>
|
>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче