Skip to content

Commit

Permalink
feat: replace icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ambar committed Apr 4, 2024
1 parent 7e84e50 commit 8be13e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bundle-watch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/setup-node@v4
- uses: preactjs/compressed-size-action@v2
with:
pattern: 'out/**/*.*'
pattern: '{images,out}/**/*.*'
4 changes: 1 addition & 3 deletions images/electron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions images/node.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ function debounce<T extends AnyFunction<void>>(fn: T, wait: number) {
} as T
}

// https://icon-sets.iconify.design/devicon/
const iconMap: Record<Platform, string> = {
browser: 'images/electron.svg',
node: 'images/node.svg',
}

function setPanelTitleAndIcon(
panel: vscode.WebviewPanel,
document: vscode.TextDocument
Expand All @@ -308,15 +314,9 @@ function setPanelTitleAndIcon(
`Preview` +
(document ? ' ' + path.basename(document.uri.fsPath) : '') +
` in ${platformTitleMap[currentPlatform]}`
const iconMap = {
browser: 'electron',
node: 'node',
}
panel.iconPath = vscode.Uri.joinPath(
itsContext!.extensionUri,
`images/${
iconMap[currentPlatform as keyof typeof iconMap] ?? 'electron'
}.svg`
iconMap[currentPlatform]
)
}

Expand Down

0 comments on commit 8be13e0

Please sign in to comment.