Bug 1557699 - Improve CSS base, r=ladybenko

Added variables in base.css, reduced specificity

Differential Revision: https://phabricator.services.mozilla.com/D35513

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ola Gasidlo 2019-07-12 08:24:55 +00:00
Родитель c440961ac6
Коммит 05e788acf7
11 изменённых файлов: 106 добавлений и 36 удалений

Просмотреть файл

@ -2,11 +2,23 @@
* 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/. */
/*
* Global styles
*/
@import "resource://devtools/client/application/src/base.css";
/*
* Components
*/
@import "resource://devtools/client/application/src/components/App.css"; @import "resource://devtools/client/application/src/components/App.css";
@import "resource://devtools/client/application/src/components/Worker.css"; @import "resource://devtools/client/application/src/components/Worker.css";
@import "resource://devtools/client/application/src/components/WorkerList.css"; @import "resource://devtools/client/application/src/components/WorkerList.css";
@import "resource://devtools/client/application/src/components/WorkerListEmpty.css"; @import "resource://devtools/client/application/src/components/WorkerListEmpty.css";
/*
* Reset
*/
* { * {
box-sizing: border-box; box-sizing: border-box;
} }

Просмотреть файл

@ -0,0 +1,61 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
:root {
/* Typography from Photon */
/* See https://firefox-dev.tools/photon/visuals/typography.html */
--body-10-font-size: 13px;
--body-10-font-weight: 400;
--body-20-font-size: 15px;
--body-20-font-weight: 400;
--body-20-font-weight-bold: 700;
--title-20-font-size: 17px;
--title-20-font-weight: 600;
--title-30-font-size: 22px;
--title-30-font-weight: 300;
/* Global styles */
--base-font-size: var(--body-10-font-size);
--base-font-weight: var(--body-10-font-weight);
--base-line-height: 1.8;
--list-line-height: 1.25;
/* Global colours */
--bg-color: var(--grey-10);
--text-color: var(--grey-90);
/* Global layout vars */
--base-unit: 4px;
}
/*
* Reset some tags
*/
body {
margin: 0;
padding: 0;
line-height: var(--base-line-height);
}
ul {
line-height: var(--list-line-height);
}
a {
color: var(--theme-highlight-blue);
text-decoration: none;
cursor: pointer;
}
h1,
.application--title {
font-size: var(--title-30-font-size);
font-weight: var(--title-30-font-weight);
line-height: var(--base-line-height);
}
p {
margin: 0;
}

Просмотреть файл

@ -6,26 +6,10 @@
* General styles * General styles
*/ */
h1 {
font-size: 22px;
font-weight: normal;
}
a {
margin: 0 10px;
}
a,
a:hover,
a:visited {
color: var(--theme-highlight-blue) !important;
cursor: pointer;
}
a.disabled-link, a.disabled-link,
a.disabled-link:hover, a.disabled-link:hover,
a.disabled-link:visited { a.disabled-link:visited {
opacity: 0.5 !important; opacity: 0.5;
cursor: not-allowed; cursor: not-allowed;
} }

Просмотреть файл

@ -22,9 +22,8 @@
width: 100%; width: 100%;
grid-column-gap: 0; grid-column-gap: 0;
padding: 1rem 0; padding: 1rem 0;
line-height: 1.5; line-height: 1.5;
font-size: 1.2rem; font-size: var(--body-10-font-size);
} }
.worker:first-child { .worker:first-child {
@ -73,3 +72,8 @@
.worker__data__updated { .worker__data__updated {
color: var(--theme-text-color-alt); color: var(--theme-text-color-alt);
} }
.worker__link-start,
.worker__link-debug {
margin: 0 calc(var(--base-unit) * 2);
}

Просмотреть файл

@ -154,7 +154,7 @@ class Worker extends Component {
}, },
a({ a({
onClick: !shallDisableLink ? this.debug : null, onClick: !shallDisableLink ? this.debug : null,
className: `${linkClass} worker__debug-link js-debug-link`, className: `${linkClass} worker__link-debug js-link-debug`,
}) })
); );
return link; return link;
@ -174,7 +174,7 @@ class Worker extends Component {
}, },
a({ a({
onClick: this.start, onClick: this.start,
className: `worker__start-link js-start-link ${linkClass}`, className: `worker__link-start js-link-start ${linkClass}`,
}) })
); );
return link; return link;

Просмотреть файл

@ -42,7 +42,12 @@ class WorkerList extends Component {
return [ return [
article( article(
{ className: "workers-container" }, { className: "workers-container" },
Localized({ id: "serviceworker-list-header" }, h1({})), Localized(
{ id: "serviceworker-list-header" },
h1({
className: "application--title",
})
),
ul( ul(
{}, {},
workers.map(worker => workers.map(worker =>
@ -56,7 +61,7 @@ class WorkerList extends Component {
), ),
Localized( Localized(
{ {
id: "serviceworker-list-aboutdebugging2", id: "serviceworker-list-aboutdebugging",
a: a({ a: a({
className: "aboutdebugging-plug__link", className: "aboutdebugging-plug__link",
onClick: () => openTrustedLink("about:debugging#workers"), onClick: () => openTrustedLink("about:debugging#workers"),

Просмотреть файл

@ -3,16 +3,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
.worker-list-empty { .worker-list-empty {
max-width: 65rem; max-width: calc(var(--base-unit) * 179);
font-size: 1.2rem; font-size: var(--body-10-font-size);
line-height: 1.25;
color: var(--theme-toolbar-color); color: var(--theme-toolbar-color);
} }
.worker-list-empty__title { .worker-list-empty__title {
font-size: 1.4rem; font-size: var(--title-20-font-size);
font-weight: var(--title-20-font-weight);
} }
.worker-list-empty__title .external-link {
font-weight: var(--title-30-font-weight);
}
.worker-list-empty__tips { .worker-list-empty__tips {
margin-inline-start: 2rem; margin-inline-start: 2rem;
} }
@ -20,4 +24,4 @@
.worker-list-empty__tips__item { .worker-list-empty__tips__item {
margin-block-start: 0.5rem; margin-block-start: 0.5rem;
margin-block-end: 0.5rem; margin-block-end: 0.5rem;
} }

Просмотреть файл

@ -13,7 +13,6 @@ const {
const { const {
a, a,
article, article,
h1,
li, li,
p, p,
ul, ul,
@ -64,7 +63,7 @@ class WorkerListEmpty extends Component {
onClick: () => this.openDocumentation(), onClick: () => this.openDocumentation(),
}), }),
}, },
h1({ className: "worker-list-empty__title" }) p({ className: "worker-list-empty__title" })
), ),
Localized({ id: "serviceworker-empty-suggestions" }, p({})), Localized({ id: "serviceworker-empty-suggestions" }, p({})),
ul( ul(

Просмотреть файл

@ -10,6 +10,7 @@ DIRS += [
] ]
DevToolsModules( DevToolsModules(
'base.css',
'constants.js', 'constants.js',
'create-store.js', 'create-store.js',
) )

Просмотреть файл

@ -29,13 +29,13 @@ add_task(async function() {
const container = getWorkerContainers(doc)[0]; const container = getWorkerContainers(doc)[0];
info("Wait until the debug link is displayed and enabled"); info("Wait until the debug link is displayed and enabled");
await waitUntil(() => await waitUntil(() =>
container.querySelector(".js-debug-link:not(.worker__debug-link--disabled)") container.querySelector(".js-link-debug:not(.worker__debug-link--disabled)")
); );
info("Click on the debug link and wait for the new toolbox to be ready"); info("Click on the debug link and wait for the new toolbox to be ready");
const onToolboxReady = gDevTools.once("toolbox-ready"); const onToolboxReady = gDevTools.once("toolbox-ready");
const debugLink = container.querySelector(".js-debug-link"); const debugLink = container.querySelector(".js-link-debug");
debugLink.click(); debugLink.click();
const serviceWorkerToolbox = await onToolboxReady; const serviceWorkerToolbox = await onToolboxReady;

Просмотреть файл

@ -29,10 +29,10 @@ add_task(async function() {
info("Wait until the start link is displayed and enabled"); info("Wait until the start link is displayed and enabled");
const container = getWorkerContainers(doc)[0]; const container = getWorkerContainers(doc)[0];
await waitUntil(() => await waitUntil(() =>
container.querySelector(".js-start-link:not(.disabled-link)") container.querySelector(".js-link-start:not(.disabled-link)")
); );
info("Click the link and wait for the worker to start"); info("Click the link and wait for the worker to start");
const link = container.querySelector(".js-start-link"); const link = container.querySelector(".js-link-start");
link.click(); link.click();
await waitUntil( await waitUntil(
() => container.querySelector(".js-worker-status").textContent === "Running" () => container.querySelector(".js-worker-status").textContent === "Running"
@ -61,9 +61,9 @@ add_task(async function() {
info("Wait until the start link is displayed"); info("Wait until the start link is displayed");
const container = getWorkerContainers(doc)[0]; const container = getWorkerContainers(doc)[0];
await waitUntil(() => container.querySelector(".js-start-link")); await waitUntil(() => container.querySelector(".js-link-start"));
ok( ok(
container.querySelector(".js-start-link.disabled-link"), container.querySelector(".js-link-start.disabled-link"),
"Start link is disabled" "Start link is disabled"
); );