Skip to content

Commit

Permalink
Simplify dynamic styles
Browse files Browse the repository at this point in the history
  • Loading branch information
agatemosu committed Jul 30, 2024
1 parent 499d626 commit 5c78bf9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
3 changes: 0 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
<link rel="icon" href="./assets/icon.svg" />
<link rel="stylesheet" href="./styles/main.css" />
<script src="./script.js" type="module"></script>

<link rel="preload" href="./assets/check.svg" as="image" />
<style id="dynamic-styles"></style>

<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/monolith.min.css"
Expand Down
8 changes: 1 addition & 7 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,7 @@ function addContainerDrag(container) {
}

function dynamicStyle(checkbox) {
const importText = `@import "./styles/${checkbox.id}.css";`;

if (checkbox.checked) {
dynamicStyles.innerHTML += importText;
} else {
dynamicStyles.innerHTML = dynamicStyles.innerHTML.replace(importText, "");
}
document.body.classList.toggle(checkbox.id, checkbox.checked);
}

async function exportImage() {
Expand Down
2 changes: 1 addition & 1 deletion styles/square-img.css → styles/dynamic-styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.tier-element {
body.square-img .tier-element {
background-position: center;
background-size: cover;
width: 80px;
Expand Down
1 change: 1 addition & 0 deletions styles/main.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "./blackout.css";
@import "./buttons.css";
@import "./dynamic-styles.css";
@import "./export.css";
@import "./pickr.css";
@import "./tier-label.css";
Expand Down

0 comments on commit 5c78bf9

Please sign in to comment.