Skip to content

Commit

Permalink
Merge pull request #118 from yakisova41/local-file-load-in-popup
Browse files Browse the repository at this point in the history
✨ popup resource auto load
  • Loading branch information
yakisova41 authored Jun 8, 2024
2 parents 03b83a0 + 8ef9841 commit b9dfe73
Show file tree
Hide file tree
Showing 6 changed files with 352 additions and 26 deletions.
11 changes: 9 additions & 2 deletions dev/src/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Popup</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="app"></div>

<div class="container">
<div class="content">
<img src="logo.svg" width="50px" height="50px" />
<h1 class="title">CRX MONKEY</h1>
<p>Count: <span class="counter">0</span></p>
<button class="count-up">Count</button>
</div>
</div>
<script src="main.ts"></script>
</body>
</html>
170 changes: 170 additions & 0 deletions dev/src/popup/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 0 additions & 16 deletions dev/src/popup/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
const app = document.querySelector('#app')!;
app.innerHTML = `
<div class="container">
<h1>CRX MONKEY 🐵🤚</h1>
<p>Count: <span class="counter">0</span></p>
<button class="count-up">Count</button>
</div>
<style>
.container {
width: 300px;
height: 120px;
}
</style>
`;

let count = 0;
const counter = document.querySelector('.counter')!;
document.querySelector('.count-up')!.addEventListener('click', () => {
Expand Down
31 changes: 31 additions & 0 deletions dev/src/popup/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
body {
background: #1f1f1f;
color: #e6e6e6;
}

.container {
width: 240px;
height: 120px;
display: flex;
justify-content: center;
align-items: center;
padding: 30px;
}

.title {
margin: 0;
}

.count-up {
background: #9789e0;
color: #1d1838;
font-size: 14px;
border: none;
padding: 12px 16px;
border-radius: 100px;
cursor: pointer;
}

.counter {
font-size: 16px;
}
3 changes: 2 additions & 1 deletion packages/crx-monkey/src/node/handlers/dev/Watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export class Watch {
this.config = config;
}

protected watchFiles(filePaths: string[], onChange: (cssFilePath: string) => void) {
protected watchFiles(filePaths: string[], onChange: (filePath: string) => void) {
const watcher = chokidar.watch(filePaths, {});
watcher.on('change', (path) => {
onChange(path);
});
return watcher;
}

/**
Expand Down
Loading

0 comments on commit b9dfe73

Please sign in to comment.