From 363a8d9db6fe49205122d30db410aade14d7c906 Mon Sep 17 00:00:00 2001 From: hensm Date: Tue, 11 Dec 2018 14:07:37 +0000 Subject: [PATCH] Improve options page styling --- ext/src/_locales/en/messages.json | 10 +- ext/src/options/EditableList.jsx | 26 +++--- ext/src/options/index.css | 87 ----------------- ext/src/options/index.html | 2 +- ext/src/options/index.jsx | 47 ++++++---- ext/src/options/styles/index.css | 150 ++++++++++++++++++++++++++++++ ext/src/options/styles/mac.css | 23 +++++ 7 files changed, 223 insertions(+), 122 deletions(-) delete mode 100644 ext/src/options/index.css create mode 100644 ext/src/options/styles/index.css create mode 100644 ext/src/options/styles/mac.css diff --git a/ext/src/_locales/en/messages.json b/ext/src/_locales/en/messages.json index c758d73..eb20c60 100755 --- a/ext/src/_locales/en/messages.json +++ b/ext/src/_locales/en/messages.json @@ -25,7 +25,7 @@ "message": "HTML5 video/audio media casting." } , "optionsMediaEnabled": { - "message": "Enabled" + "message": "Media casting enabled" } , "optionsLocalMediaCategoryName": { @@ -35,7 +35,7 @@ "message": "HTTP server started by the bridge app to stream local media files to the cast receiver." } , "optionsLocalMediaEnabled": { - "message": "Enabled" + "message": "Local media casting enabled" } , "optionsLocalMediaServerPort": { "message": "HTTP server port" @@ -48,7 +48,7 @@ "message": "Sites for which to replace the user agent with a Chrome version for compatibility. Must be valid match patterns." } , "optionsUserAgentWhitelistEnabled": { - "message": "Enabled" + "message": "Site whitelist enabled" } , "optionsUserAgentWhitelistContent": { "message": "Match patterns (newline-separated)" @@ -82,14 +82,14 @@ "message": "Screen/Tab mirroring to a Chromecast receiver app." } , "optionsMirroringEnabled": { - "message": "Enabled" + "message": "Screen mirroring enabled" } , "optionsMirroringAppId": { "message": "Receiver app ID" } , "optionsReset": { - "message": "Reset to defaults" + "message": "Restore Defaults" } , "optionsSubmit": { "message": "Submit" diff --git a/ext/src/options/EditableList.jsx b/ext/src/options/EditableList.jsx index 56ebe28..0ab13b5 100644 --- a/ext/src/options/EditableList.jsx +++ b/ext/src/options/EditableList.jsx @@ -123,17 +123,19 @@ export default class EditableList extends Component { return (
- - { this.state.rawView && - } +
+ { this.state.rawView && + } + +

{ do { if (this.state.rawView) { @@ -172,4 +174,4 @@ export default class EditableList extends Component {
); } -} \ No newline at end of file +} diff --git a/ext/src/options/index.css b/ext/src/options/index.css deleted file mode 100644 index 0d6da76..0000000 --- a/ext/src/options/index.css +++ /dev/null @@ -1,87 +0,0 @@ -*:invalid { - box-shadow: 0 0 1.5px 1px red; -} - -#form { - display: flex; - flex-direction: column; -} - -#buttons { - align-self: flex-end; - margin-block-start: 5px; -} - -#buttons > :not(:last-child) { - margin-inline-end: 5px; -} - - -.category { - display: grid; - grid-template-columns: 150px 1fr; - grid-column-gap: 20px; - grid-row-gap: 5px; -} - -.category__name {} - -.category__description { - color: graytext; -} - -.category__description, -.category .category { - grid-column: span 2; -} - - -.option { - display: contents; -} - -.option__label { - text-align: right; - display: inline-block; -} - -.option > input { - align-self: center; - justify-self: flex-start; -} - - -.editable-list { - justify-content: end; -} - -.editable-list__items { - display: flex; - flex-direction: column; - padding: initial; -} - -.editable-list__item { - align-items: center; - display: flex; - height: 2em; -} - -.editable-list__title { - flex: 1; -} - -.editable-list__edit-field { - width: -moz-available; - margin-inline-end: 1em; -} - -.editable-list__raw-view { - max-height: 300px; - resize: vertical; - width: 100%; -} - -.editable-list__add-button { - align-self: end; -} diff --git a/ext/src/options/index.html b/ext/src/options/index.html index 4754571..5e9b10e 100644 --- a/ext/src/options/index.html +++ b/ext/src/options/index.html @@ -2,7 +2,7 @@ - + diff --git a/ext/src/options/index.jsx b/ext/src/options/index.jsx index 63a0147..df0721a 100644 --- a/ext/src/options/index.jsx +++ b/ext/src/options/index.jsx @@ -9,6 +9,17 @@ import EditableList from "./EditableList"; const _ = browser.i18n.getMessage; +// macOS styles +browser.runtime.getPlatformInfo() + .then(platformInfo => { + if (platformInfo.os === "mac") { + const link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = "styles/mac.css"; + document.head.appendChild(link); + } + }); + const MATCH_PATTERN_REGEX = /^(?:(?:(\*|https?|ftp):\/\/((?:\*\.|[^\/\*])+)|(file):\/\/\/?(?:\*\.|[^\/\*])+)(\/.*)|)$/; @@ -128,17 +139,18 @@ class App extends Component { { _("optionsMediaCategoryDescription") }

-