Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: light and dark mode icons #1046

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/vscode/src/app/nx-commands/nx-commands-tree-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export class NxCommandsTreeItem extends TreeItem {
tooltip: `Run nx ${this.affectedCommand}`,
};

iconPath = Uri.file(join(this.extensionPath, 'assets', 'nx-cli.svg'));
iconPath = {
light: Uri.file(join(this.extensionPath, 'assets', 'nx-cli-light.svg')),
dark: Uri.file(join(this.extensionPath, 'assets', 'nx-cli-dark.svg')),
};

constructor(
readonly affectedCommand: string,
Expand Down
11 changes: 8 additions & 3 deletions apps/vscode/src/app/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@ export function createWebViewPanel(
webviewPanel.onDidDispose(() => {
webviewPanel = undefined;
});
webviewPanel.iconPath = Uri.file(
join(context.extensionPath, 'assets', 'nx-console.svg')
);
webviewPanel.iconPath = {
light: Uri.file(
join(context.extensionPath, 'assets', 'nx-console-light.svg')
),
dark: Uri.file(
join(context.extensionPath, 'assets', 'nx-console-dark.svg')
),
};

webviewPanel.webview.html = getIframeHtml(context, schema);

Expand Down
28 changes: 18 additions & 10 deletions apps/vscode/src/app/workspace-tree/workspace-tree-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ export type WorkspaceRouteTitle =
| 'Change workspace'
| 'Select workspace';

const ROUTE_TO_ICON_MAP = new Map<WorkspaceRouteTitle | undefined, string>([
['Generate', 'nx-cli.svg'],
['Run', 'nx-cli.svg'],
['Build', 'nx-cli.svg'],
['Serve', 'nx-cli.svg'],
['Test', 'nx-cli.svg'],
['E2e', 'nx-cli.svg'],
['Lint', 'nx-cli.svg'],
const ROUTE_TO_ICON_MAP = new Map<
WorkspaceRouteTitle | undefined,
{ light: string; dark: string }
>([
['Generate', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['Run', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['Build', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['Serve', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['Test', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['E2e', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
['Lint', { light: 'nx-cli-light.svg', dark: 'nx-cli-dark.svg' }],
]);

export const ROUTE_LIST: WorkspaceRouteTitle[] = [
Expand Down Expand Up @@ -71,8 +74,13 @@ export class WorkspaceTreeItem extends TreeItem {
static getIconUriForRoute(
extensionPath: string,
route?: WorkspaceRouteTitle
): Uri | undefined {
): { light: Uri; dark: Uri } | undefined {
const icon = ROUTE_TO_ICON_MAP.get(route);
return icon ? Uri.file(join(extensionPath, 'assets', icon)) : undefined;
return icon
? {
light: Uri.file(join(extensionPath, 'assets', icon.light)),
dark: Uri.file(join(extensionPath, 'assets', icon.dark)),
}
: undefined;
}
}
14 changes: 8 additions & 6 deletions apps/vscode/src/app/workspace-tree/workspace-tree-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ export class WorkspaceTreeProvider extends AbstractTreeProvider<
readonly extensionPath: string
) {
super();
LOCATE_YOUR_WORKSPACE.iconPath = join(
extensionPath,
'assets',
'nx-console.svg'
);
CHANGE_WORKSPACE.iconPath = join(extensionPath, 'assets', 'nx-console.svg');
LOCATE_YOUR_WORKSPACE.iconPath = {
light: join(extensionPath, 'assets', 'nx-console-light.svg'),
dark: join(extensionPath, 'assets', 'nx-console-dark.svg'),
};
CHANGE_WORKSPACE.iconPath = {
light: join(extensionPath, 'assets', 'nx-console-light.svg'),
dark: join(extensionPath, 'assets', 'nx-console-dark.svg'),
};
}

getParent(_: WorkspaceTreeItem) {
Expand Down
10 changes: 10 additions & 0 deletions apps/vscode/src/assets/nx-cli-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions apps/vscode/src/assets/nx-cli-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions apps/vscode/src/assets/nx-cli.svg

This file was deleted.

10 changes: 10 additions & 0 deletions apps/vscode/src/assets/nx-console-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions apps/vscode/src/assets/nx-console-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions apps/vscode/src/assets/nx-console.svg

This file was deleted.