diff --git a/devtools/client/inspector/compatibility/components/UnsupportedBrowserItem.js b/devtools/client/inspector/compatibility/components/UnsupportedBrowserItem.js index f600dac88a54..b80177e4c51a 100644 --- a/devtools/client/inspector/compatibility/components/UnsupportedBrowserItem.js +++ b/devtools/client/inspector/compatibility/components/UnsupportedBrowserItem.js @@ -10,6 +10,41 @@ const PropTypes = require("devtools/client/shared/vendor/react-prop-types"); const Types = require("../types"); +const ICONS = { + firefox: { + src: "chrome://devtools/skin/images/browsers/firefox.svg", + isMobileIconNeeded: false, + }, + firefox_android: { + src: "chrome://devtools/skin/images/browsers/firefox.svg", + isMobileIconNeeded: true, + }, + chrome: { + src: "chrome://devtools/skin/images/browsers/chrome.svg", + isMobileIconNeeded: false, + }, + chrome_android: { + src: "chrome://devtools/skin/images/browsers/chrome.svg", + isMobileIconNeeded: true, + }, + safari: { + src: "chrome://devtools/skin/images/browsers/safari.svg", + isMobileIconNeeded: false, + }, + safari_ios: { + src: "chrome://devtools/skin/images/browsers/safari.svg", + isMobileIconNeeded: true, + }, + edge: { + src: "chrome://devtools/skin/images/browsers/edge.svg", + isMobileIconNeeded: false, + }, + edge_mobile: { + src: "chrome://devtools/skin/images/browsers/edge.svg", + isMobileIconNeeded: true, + }, +}; + class UnsupportedBrowserItem extends PureComponent { static get propTypes() { return { @@ -25,14 +60,30 @@ class UnsupportedBrowserItem extends PureComponent { } render() { - const { name, versions } = this.props; + const { id, name, versions } = this.props; const versionsTitle = versions .map(({ alias, version }) => version + (alias ? `(${alias})` : "")) .join(", "); const title = `${name} ${versionsTitle}`; - return dom.li({ title }, name); + const icon = ICONS[id]; + + return dom.li( + { + className: + "compatibility-unsupported-browser-item" + + (icon.isMobileIconNeeded + ? " compatibility-unsupported-browser-item--mobile" + : ""), + }, + dom.img({ + className: "compatibility-unsupported-browser-item__icon", + alt: title, + title, + src: icon.src, + }) + ); } } diff --git a/devtools/client/inspector/compatibility/components/UnsupportedBrowserList.js b/devtools/client/inspector/compatibility/components/UnsupportedBrowserList.js index 621bb9c30600..6e66528b7b56 100644 --- a/devtools/client/inspector/compatibility/components/UnsupportedBrowserList.js +++ b/devtools/client/inspector/compatibility/components/UnsupportedBrowserList.js @@ -51,7 +51,9 @@ class UnsupportedBrowserList extends PureComponent { ); return dom.ul( - {}, + { + className: "compatibility-unsupported-browser-list", + }, [...browsersMap.entries()].map(([id, { name, versions }]) => UnsupportedBrowserItem({ key: id, id, name, versions }) ) diff --git a/devtools/client/jar.mn b/devtools/client/jar.mn index b6f5ae63c71d..c846d193ef39 100644 --- a/devtools/client/jar.mn +++ b/devtools/client/jar.mn @@ -100,6 +100,11 @@ devtools.jar: skin/images/performance-details-waterfall.svg (themes/images/performance-details-waterfall.svg) skin/images/performance-details-call-tree.svg (themes/images/performance-details-call-tree.svg) skin/images/performance-details-flamegraph.svg (themes/images/performance-details-flamegraph.svg) + skin/images/browsers/firefox.svg (themes/images/browsers/firefox.svg) + skin/images/browsers/chrome.svg (themes/images/browsers/chrome.svg) + skin/images/browsers/edge.svg (themes/images/browsers/edge.svg) + skin/images/browsers/safari.svg (themes/images/browsers/safari.svg) + skin/images/browsers/mobile.svg (themes/images/browsers/mobile.svg) skin/breadcrumbs.css (themes/breadcrumbs.css) skin/chart.css (themes/chart.css) skin/widgets.css (themes/widgets.css) diff --git a/devtools/client/themes/compatibility.css b/devtools/client/themes/compatibility.css index ac6527fd54ab..7f0a08b8067d 100644 --- a/devtools/client/themes/compatibility.css +++ b/devtools/client/themes/compatibility.css @@ -6,6 +6,7 @@ --compatibility-base-unit: 4px; --compatibility-cause-color: var(--theme-text-color-alt); --compatibility-issue-icon-size: calc(var(--compatibility-base-unit) * 3); + --compatibility-unsupported-browser-icon-size: calc(var(--compatibility-base-unit) * 4); } .compatibility-app { @@ -19,14 +20,30 @@ padding: 0; } +/* + * Layout of the issue item + * +------+--------------+-----------------+---------------------------+ + * | icon | issue factor | (issue causes)? | unsupported browser icons | + * +------+--------------+-----------------+---------------------------+ + */ .compatibility-issue-item { - display: flex; - gap: var(--compatibility-base-unit); + display: grid; + grid-template-columns: var(--compatibility-issue-icon-size) max-content 1fr max-content; align-items: center; padding-inline-start: calc(var(--compatibility-base-unit) * 2); + padding-inline-end: calc(var(--compatibility-base-unit) * 4); padding-block: calc(var(--compatibility-base-unit) * 2); } +.compatibility-issue-item > *:nth-child(-n+2) { + /* + * The reason why we don't use `gap` in `.compatibility-issue-item` is + * because there are cases that the `issue causes` element is null, + * then the layout will be broken a bit. + */ + margin-inline-start: var(--compatibility-base-unit); +} + .compatibility-issue-item:not(:last-child) { border-block-end: 1px solid var(--theme-splitter-color); } @@ -57,3 +74,41 @@ color: var(--theme-highlight-blue); text-decoration: none; } + +.compatibility-unsupported-browser-list { + display: flex; + align-items: center; + justify-content: end; + list-style: none; + padding: 0; + gap: calc(var(--compatibility-base-unit) * 2); +} + +.compatibility-unsupported-browser-item { + width: var(--compatibility-unsupported-browser-icon-size); + height: var(--compatibility-unsupported-browser-icon-size); + position: relative; +} + +.compatibility-unsupported-browser-item--mobile::after { + content: ""; + width: calc(var(--compatibility-base-unit) * 2); + height: calc(var(--compatibility-base-unit) * 3); + background-color: var(--theme-body-background); + background-size: calc(var(--compatibility-base-unit) * 2 - 2px); + background-position: center; + background-repeat: no-repeat; + background-image: url(chrome://devtools/skin/images/browsers/mobile.svg); + -moz-context-properties: fill; + fill: var(--theme-icon-dimmed-color); + position: absolute; + right: calc(var(--compatibility-base-unit) * -1); + bottom: calc(var(--compatibility-base-unit) * -1); +} + +.compatibility-unsupported-browser-item__icon { + width: 100%; + height: 100%; + fill: var(--theme-icon-dimmed-color); + -moz-context-properties: fill; +} diff --git a/devtools/client/themes/images/browsers/chrome.svg b/devtools/client/themes/images/browsers/chrome.svg new file mode 100644 index 000000000000..81170e843e27 --- /dev/null +++ b/devtools/client/themes/images/browsers/chrome.svg @@ -0,0 +1,8 @@ + + diff --git a/devtools/client/themes/images/browsers/edge.svg b/devtools/client/themes/images/browsers/edge.svg new file mode 100644 index 000000000000..2fa13e154617 --- /dev/null +++ b/devtools/client/themes/images/browsers/edge.svg @@ -0,0 +1,8 @@ + + diff --git a/devtools/client/themes/images/browsers/firefox.svg b/devtools/client/themes/images/browsers/firefox.svg new file mode 100644 index 000000000000..49283bad5132 --- /dev/null +++ b/devtools/client/themes/images/browsers/firefox.svg @@ -0,0 +1,8 @@ + + diff --git a/devtools/client/themes/images/browsers/mobile.svg b/devtools/client/themes/images/browsers/mobile.svg new file mode 100644 index 000000000000..ddf32f3c3fa1 --- /dev/null +++ b/devtools/client/themes/images/browsers/mobile.svg @@ -0,0 +1,8 @@ + + diff --git a/devtools/client/themes/images/browsers/safari.svg b/devtools/client/themes/images/browsers/safari.svg new file mode 100644 index 000000000000..cfe2b4633dad --- /dev/null +++ b/devtools/client/themes/images/browsers/safari.svg @@ -0,0 +1,8 @@ + +