Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit 69f521a

Browse files
committed
style: move styles into CSS
1 parent a428729 commit 69f521a

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

main.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,10 @@ class CssSnippetStoreModal extends Modal {
291291
placeholder: 'Search snippets...',
292292
});
293293
searchInput.classList.add('snippet-search-input');
294-
searchInput.style.marginBottom = '1rem';
295-
searchInput.style.width = '100%';
296-
searchInput.style.padding = '0.5rem';
297294

298295
// Message container
299296
const messageEl = topContainer.createEl('div');
300297
messageEl.classList.add('snippet-status-message');
301-
messageEl.style.marginTop = '0.5rem';
302-
messageEl.style.textAlign = 'center';
303-
messageEl.style.color = 'var(--text-muted)';
304-
messageEl.style.fontStyle = 'italic';
305298

306299
// Snippet container
307300
contentEl.createEl('div', { cls: 'community-items-container' });
@@ -365,8 +358,7 @@ class SnippetReadmeModal extends Modal {
365358
const { contentEl } = this;
366359
contentEl.empty();
367360
contentEl.addClass("snippet-readme-modal");
368-
this.modalEl.style.width = "80vw";
369-
this.modalEl.style.height = "80vh";
361+
this.modalEl.addClass("snippet-readme-modal-element");
370362

371363
// Show loading indicator if no content yet
372364
if (!this.readmeContent) {
@@ -405,10 +397,7 @@ class SnippetReadmeModal extends Modal {
405397
// Optimize image loading
406398
markdownContainer.querySelectorAll("img").forEach((img) => {
407399
img.setAttribute("loading", "lazy");
408-
img.style.maxWidth = "100%";
409-
img.style.height = "auto";
410-
img.style.display = "block";
411-
img.style.margin = "1rem auto";
400+
img.addClass("snippet-readme-image");
412401
});
413402
} catch (error) {
414403
console.error("Error rendering README:", error);

styles.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,29 @@
2020
margin-top: var(--size-4-2);
2121
display: flex;
2222
justify-content: flex-end;
23+
}
24+
25+
.snippet-search-input {
26+
margin-bottom: 1rem;
27+
width: 100%;
28+
padding: 0.5rem;
29+
}
30+
31+
.snippet-status-message {
32+
margin-top: 0.5rem;
33+
text-align: center;
34+
color: var(--text-muted);
35+
font-style: italic;
36+
}
37+
38+
.snippet-readme-modal-element {
39+
width: 80vw;
40+
height: 80vh;
41+
}
42+
43+
.snippet-readme-image {
44+
max-width: 100%;
45+
height: auto;
46+
display: block;
47+
margin: 1rem auto;
2348
}

0 commit comments

Comments
 (0)