diff --git a/package.json b/package.json index 5cbe8da..dfac079 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "bundle.js", "scripts": { "start": "node_modules/.bin/webpack --watch", + "build": "node_modules/.bin/webpack", "test": "node_modules/.bin/jest", "test:watch": "node_modules/.bin/jest --watch", "release": "copyfiles main.css main.min.js background.min.js manifest.json popup.html options.html node_modules/jquery/dist/jquery.min.js node_modules/select2/select2.js src/images/* release" @@ -20,6 +21,7 @@ "react": "^16.8.0", "react-dom": "^16.8.0", "react-select": "^2.3.0", + "react-shadow": "^16.3.2", "route-parser": "^0.0.5" }, "devDependencies": { @@ -42,6 +44,7 @@ "file-loader": "^3.0.1", "html-webpack-plugin": "^3.2.0", "jest": "^24.1.0", + "mini-css-extract-plugin": "^0.5.0", "node-sass": "^4.11.0", "prettier": "^1.16.4", "sass-loader": "^7.1.0", diff --git a/src/css/_form.scss b/src/css/_form.scss index 727184e..b8f0dd6 100644 --- a/src/css/_form.scss +++ b/src/css/_form.scss @@ -1,93 +1,91 @@ -#moco-bx-container { - input { - border-radius: 0; +input { + border-radius: 0; +} + +.form-group { + width: 100%; + margin: 1rem 0; + + label { + display: block; + font-weight: bold; + margin-bottom: 0.25rem; } - .form-group { + input, textarea { + padding: 0.25rem 0.5rem; + background-color: white; + border-color: #cccccc; width: 100%; - margin: 1rem 0; + } - label { - display: block; - font-weight: bold; - margin-bottom: 0.25rem; - } + text-muted { + color: #eee; + } + &.has-error { input, textarea { - padding: 0.25rem 0.5rem; - background-color: white; - border-color: #cccccc; - width: 100%; + border-color: #FB3A2F; } + } - text-muted { - color: #eee; - } + .form-error { + color: #FB3A2F; + } - &.has-error { - input, textarea { - border-color: #FB3A2F; - } - } + .input-group { + position: relative; + display: table; + border-collapse: separate; - .form-error { - color: #FB3A2F; - } - - .input-group { + input { position: relative; - display: table; - border-collapse: separate; - - input { - position: relative; - display: table-cell; - } - - .input-group-addon { - padding: 0.25rem 0.5rem; - font-weight: normal; - color: #555555; - text-align: center; - background-color: #eeeeee; - border: 1px solid #cccccc; - border-left: none; - display: table-cell; - width: 1%; - } - } - } - - input[name="hours"] { - width: 33%; - } - - textarea[name="description"] { - resize: none; - width: 100%; - } - - button { - display: inline-block; - padding: 6px 12px; - margin-bottom: 0; - font-weight: normal; - text-align: center; - white-space: nowrap; - color: white; - background-image: none; - background-color: #7dc332; - border-color: #7dc332; - cursor: pointer; - - &:hover:not(:disabled) { - background-color: #639a28; - border-color: #639a28; + display: table-cell; } - &:disabled { - opacity: 0.65; - cursor: default; + .input-group-addon { + padding: 0.25rem 0.5rem; + font-weight: normal; + color: #555555; + text-align: center; + background-color: #eeeeee; + border: 1px solid #cccccc; + border-left: none; + display: table-cell; + width: 1%; } } } + +input[name="hours"] { + width: 33%; +} + +textarea[name="description"] { + resize: none; + width: 100%; +} + +button { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-weight: normal; + text-align: center; + white-space: nowrap; + color: white; + background-image: none; + background-color: #7dc332; + border-color: #7dc332; + cursor: pointer; + + &:hover:not(:disabled) { + background-color: #639a28; + border-color: #639a28; + } + + &:disabled { + opacity: 0.65; + cursor: default; + } +} diff --git a/src/css/_reset.scss b/src/css/_reset.scss new file mode 100644 index 0000000..356a32d --- /dev/null +++ b/src/css/_reset.scss @@ -0,0 +1,45 @@ +#moco-bx-bubble, #moco-bx-container { + html, body, div, span, applet, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + a, abbr, acronym, address, big, cite, code, + del, dfn, em, img, ins, kbd, q, s, samp, + small, strike, strong, sub, sup, tt, var, + b, u, i, center, + dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, embed, + figure, figcaption, footer, header, hgroup, + menu, nav, output, ruby, section, summary, + time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + } + /* HTML5 display-role reset for older browsers */ + article, aside, details, figcaption, figure, + footer, header, hgroup, menu, nav, section { + display: block; + } + body { + line-height: 1; + } + ol, ul { + list-style: none; + } + blockquote, q { + quotes: none; + } + blockquote:before, blockquote:after, + q:before, q:after { + content: ''; + content: none; + } + table { + border-collapse: collapse; + border-spacing: 0; + } +} diff --git a/src/css/_spinner.scss b/src/css/_spinner.scss index 9bbf7d8..acbbc68 100644 --- a/src/css/_spinner.scss +++ b/src/css/_spinner.scss @@ -1,11 +1,11 @@ #moco-bx-bubble, #moco-bx-container { - @keyframes spinner { + @keyframes moco-bx-spinner { to { transform: rotate(360deg); } } - .spinner { + .moco-bx-spinner { display: inline-block; width: 2rem; height: 2rem; @@ -13,6 +13,6 @@ border: 2px solid #999; border-right-color: transparent; border-radius: 50%; - animation: spinner .75s linear infinite; + animation: moco-bx-spinner .75s linear infinite; } } diff --git a/src/css/content.scss b/src/css/content.scss new file mode 100644 index 0000000..57b4c49 --- /dev/null +++ b/src/css/content.scss @@ -0,0 +1,31 @@ +@import "mixins"; +@import "form"; +@import "spinner"; + +.moco-bx-bubble { + img { + width: 30px; + height: 30px; + } +} + +.moco-bx-modal { + position: fixed; /* Stay in place */ + z-index: 2000; /* Sit on top */ + padding-top: 100px; /* Location of the box */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0, 0, 0); /* Fallback color */ + background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */ + + .moco-bx-modal-content { + background-color: white; + width: 600px; + padding: 40px; + margin: 0 auto; + } +} + diff --git a/src/css/main.scss b/src/css/main.scss deleted file mode 100644 index 8b4323e..0000000 --- a/src/css/main.scss +++ /dev/null @@ -1,48 +0,0 @@ -@import "mixins"; -@import "form"; -@import "spinner"; - -#moco-bx-bubble { - position: fixed; - bottom: 40px; - left: 50%; - margin-left: -30px; - z-index: 1000; - - height: 60px; - width: 60px; - background-color: white; - border-radius: 50%; - box-shadow: -1px -1px 15px 4px rgba(0, 0, 0, 0.05), - 2px 2px 15px 4px rgba(0, 0, 0, 0.05); - padding: 5px; - - display: flex; - flex-direction: column; - justify-content: space-around; - align-items: center; - - cursor: pointer; -} - -#moco-bx-container { - .moco-bx-modal { - position: fixed; /* Stay in place */ - z-index: 2000; /* Sit on top */ - padding-top: 100px; /* Location of the box */ - left: 0; - top: 0; - width: 100%; /* Full width */ - height: 100%; /* Full height */ - overflow: auto; /* Enable scroll if needed */ - background-color: rgb(0, 0, 0); /* Fallback color */ - background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */ - } - - .moco-bx-modal-content { - background-color: white; - width: 600px; - padding: 40px; - margin: 0 auto; - } -} diff --git a/src/css/options.scss b/src/css/options.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 0000000..22e7901 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,22 @@ +#moco-bx-root { + position: fixed; + bottom: 40px; + left: 50%; + margin-left: -30px; + z-index: 1000; + + height: 60px; + width: 60px; + background-color: white; + border-radius: 50%; + box-shadow: -1px -1px 15px 4px rgba(0, 0, 0, 0.05), + 2px 2px 15px 4px rgba(0, 0, 0, 0.05); + padding: 5px; + + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; + + cursor: pointer; +} diff --git a/src/js/components/Bubble.js b/src/js/components/Bubble.js index 3aefa72..0efe667 100644 --- a/src/js/components/Bubble.js +++ b/src/js/components/Bubble.js @@ -1,7 +1,7 @@ import React, { Component } from "react" import PropTypes from "prop-types" import ApiClient from "api/Client" -import Modal, { Content } from "components/Modal" +import Modal from "components/Modal" import InvalidConfigurationError from "components/InvalidConfigurationError" import Form from "components/Form" import Spinner from "components/Spinner" @@ -160,6 +160,7 @@ class Bubble extends Component { // EVENT HANDLERS ----------------------------------------------------------- handleKeyDown = event => { + event.stopPropagation() if (event.keyCode === 27) { this.close() } @@ -223,19 +224,18 @@ class Bubble extends Component { } return ( - <> +