Made input styling shared
This commit is contained in:
parent
fd07001983
commit
9089589d36
@ -1,3 +1,5 @@
|
|||||||
|
@import "shared.css";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -342,4 +344,3 @@ a {
|
|||||||
.sidebar ul li a:hover {
|
.sidebar ul li a:hover {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,24 @@
|
|||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
// THE SOFTWARE.
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
const getAdoptionStyles = () => {
|
||||||
|
return Array.from(document.styleSheets)
|
||||||
|
.filter((styleSheet) => styleSheet.href?.endsWith("shared.css"))
|
||||||
|
.map(x => {
|
||||||
|
const sheet = new CSSStyleSheet();
|
||||||
|
|
||||||
|
sheet.replaceSync(Array.from(x.cssRules).flatMap(rule => {
|
||||||
|
if (rule instanceof CSSImportRule) {
|
||||||
|
return Array.from(rule.styleSheet.cssRules).map(rule => rule.cssText);
|
||||||
|
} else {
|
||||||
|
return rule.cssText;
|
||||||
|
}
|
||||||
|
}).join(' '));
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
class GenericField extends HTMLElement {
|
class GenericField extends HTMLElement {
|
||||||
form = null;
|
form = null;
|
||||||
field = null;
|
field = null;
|
||||||
@ -83,18 +101,6 @@ class GenericField extends HTMLElement {
|
|||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
color: #e6e6e6;
|
color: #e6e6e6;
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: 2px solid #f05a28 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:focus::placeholder {
|
|
||||||
opacity: 0.4;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -155,6 +161,9 @@ class GenericField extends HTMLElement {
|
|||||||
this.container.appendChild(this.styleElement);
|
this.container.appendChild(this.styleElement);
|
||||||
|
|
||||||
this.shadowRoot.appendChild(this.container);
|
this.shadowRoot.appendChild(this.container);
|
||||||
|
|
||||||
|
|
||||||
|
this.shadowRoot.adoptedStyleSheets = getAdoptionStyles();
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
|
15
src/snek/static/shared.css
Normal file
15
src/snek/static/shared.css
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid #f05a28 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
transition: opacity 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus::placeholder {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
@ -1,55 +1,57 @@
|
|||||||
|
@import "shared.css";
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
box-sizing: border-box;
|
.dialog {
|
||||||
|
background-color: #0f0f0f;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 30px;
|
||||||
|
width: 800px;
|
||||||
|
margin: 30px;
|
||||||
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 500px) {
|
||||||
|
.center {
|
||||||
|
width: 100%;
|
||||||
|
left: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog {
|
.dialog {
|
||||||
|
width: 100%;
|
||||||
background-color: #0f0f0f;
|
left: 0px;
|
||||||
border-radius: 10px;
|
|
||||||
padding: 30px;
|
|
||||||
width: 800px;
|
|
||||||
margin: 30px;
|
|
||||||
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 500px) {
|
|
||||||
.center {
|
|
||||||
width: 100%;
|
|
||||||
left: 0px;
|
|
||||||
}
|
|
||||||
.dialog {
|
|
||||||
width: 100%;
|
|
||||||
left: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
color: #f05a28;
|
color: #f05a28;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.4em;
|
font-size: 1.4em;
|
||||||
color: #f05a28;
|
color: #f05a28;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
color: #e6e6e6;
|
color: #e6e6e6;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
}
|
}
|
@ -20,6 +20,7 @@
|
|||||||
<script src="/html-frame.js"></script>
|
<script src="/html-frame.js"></script>
|
||||||
<script src="/generic-form.js"></script>
|
<script src="/generic-form.js"></script>
|
||||||
<link rel="stylesheet" href="/html-frame.css">
|
<link rel="stylesheet" href="/html-frame.css">
|
||||||
|
<link rel="stylesheet" href="/shared.css">
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user