diff --git a/app/templates/selectbox/index.js b/app/templates/selectbox/index.js
index 51393035..f44333ca 100644
--- a/app/templates/selectbox/index.js
+++ b/app/templates/selectbox/index.js
@@ -1,59 +1,32 @@
const html = require('choo/html');
-const number = require('../../utils').number;
module.exports = function(selected, options, translate, changed) {
const id = `select-${Math.random()}`;
let x = selected;
return html`
-
-
-
${translate(selected)}
-
-
-
+
+
-
`;
-
- function close() {
- const ul = document.getElementById(id);
- const body = document.querySelector('body');
- ul.classList.remove('selectbox__options--active');
- body.removeEventListener('click', close);
- }
-
- function toggle(event) {
- event.stopPropagation();
- const ul = document.getElementById(id);
- if (ul.classList.contains('selectbox__options--active')) {
- close();
- } else {
- ul.classList.add('selectbox__options--active');
- const body = document.querySelector('body');
- body.addEventListener('click', close);
- }
- }
+
+
+
+ `;
function choose(event) {
- event.stopPropagation();
const target = event.target;
- const value = +target.dataset.value;
- target.parentNode.previousSibling.firstElementChild.textContent = translate(
- value
- );
+ const value = +target.value;
+
if (x !== value) {
x = value;
changed(value);
}
- close();
}
};
diff --git a/app/templates/selectbox/selectbox.css b/app/templates/selectbox/selectbox.css
index 2cacc960..968b0a0d 100644
--- a/app/templates/selectbox/selectbox.css
+++ b/app/templates/selectbox/selectbox.css
@@ -1,36 +1,27 @@
-.selectbox {
- display: inline-block;
- position: relative;
- cursor: pointer;
-}
-
-.selectbox__options {
- display: none;
-}
-
-.selectbox__options--active {
- display: block;
- position: absolute;
- top: 0;
- left: 0;
- padding: 0;
- margin: 40px 0;
+.select {
background-color: var(--pageBGColor);
- border: 1px solid rgba(12, 12, 13, 0.3);
- border-radius: 4px;
- box-shadow: 1px 2px 4px rgba(12, 12, 13, 0.3);
+ overflow: hidden;
}
-.selectbox__option {
- color: var(--lightTextColor);
- font-size: 12pt;
- list-style: none;
- user-select: none;
- white-space: nowrap;
- padding: 0 60px;
- border-bottom: 1px solid rgba(12, 12, 13, 0.3);
+select {
+ appearance: none;
+ outline: 0;
+ box-shadow: none;
+ border: 0;
+ background: #fff;
+ background-image: none;
+ font-size: 1em;
+ margin: 0;
+ color: #0094fb;
+ cursor: pointer;
+ border-color: none;
}
-.selectbox__option:hover {
- background-color: #f4f4f4;
+select:active {
+ background-color: var(--pageBGColor);
+ border: 0;
+}
+
+#arrow {
+ position: relative;
}