add switches

This commit is contained in:
Lauchmelder 2022-03-20 16:25:50 +01:00
parent be5c885ebc
commit 09caab1e59
No known key found for this signature in database
GPG key ID: C2403C69D78F011D
3 changed files with 132 additions and 16 deletions

View file

@ -22,23 +22,32 @@
</div> </div>
<div id="settings-area"> <div id="settings-area">
<label class="switch"> <div class="setting" id="setting-global">
<input type="checkbox"> <label class="switch">
<span class="slider round"></span> <input type="checkbox">
test 1 <span class="slider round"></span>
</label> </label>
<label class="switch"> <span class="description">Enable Furikani</span>
<input type="checkbox"> </div>
<span class="slider round"></span>
test 2 <div class="setting" id="setting-vocabulary">
</label> <label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
<label class="switch"> <span class="description">Use Vocabulary List</span>
<input type="checkbox"> </div>
<span class="slider round"></span>
test 3 <div class="setting" id="setting-kanji">
</label> <label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
<span class="description">Use Kanji List</span>
</div>
</div> </div>
<footer> <footer>

View file

@ -3,6 +3,10 @@ const inputField = document.getElementById("token")
const statusField = document.getElementById("token-status") const statusField = document.getElementById("token-status")
const errorField = document.getElementById("error-text") const errorField = document.getElementById("error-text")
const globalSetting = document.getElementById("setting-global")
const vocabSetting = document.getElementById("setting-vocabulary")
const kanjiSetting = document.getElementById("setting-kanji")
// Set popup content // Set popup content
chrome.storage.local.get(["level", "token"], (data) => { chrome.storage.local.get(["level", "token"], (data) => {
if(data.token === undefined) if(data.token === undefined)

View file

@ -3,6 +3,7 @@
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
box-sizing: border-box; box-sizing: border-box;
border-radius: 0px;
} }
body body
@ -10,6 +11,7 @@ body
display: grid; display: grid;
grid-template-rows: 1.5fr 1fr 3fr 2fr; grid-template-rows: 1.5fr 1fr 3fr 2fr;
width: 250px; width: 250px;
margin: 0.5rem;
} }
header header
@ -22,11 +24,12 @@ header
h1 h1
{ {
text-transform: uppercase; text-transform: uppercase;
font-size: 30pt;
} }
h2 h2
{ {
font-size: 10pt; font-size: 12pt;
} }
#token-area #token-area
@ -46,8 +49,108 @@ h2
font-size: 1rem; font-size: 1rem;
} }
#token
{
border-width: 1px;
}
#submit-token
{
border-width: 1px;
background-color: white;
font-size: 1rem;
}
#submit-token:hover
{
background-color: grey;
}
#submit-token:host()
{
background-color: rgb(85, 85, 85);
}
#settings-area #settings-area
{ {
display: grid; display: grid;
grid-template-rows: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.setting
{
display: grid;
grid-template-columns: 1fr 3fr;
align-items: center;
}
.description
{
display: flex;
align-items: center;
}
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
align-items: center;
width: 60px;
height: 34px;
transform: scale(0.65);
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
} }