From afb0247063bd859f43c1d10af3713a2ff14c5d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aneta=20Jastrz=C4=99bska?= Date: Sat, 21 Sep 2024 11:38:31 +0200 Subject: [PATCH 1/3] inject vscode css vars --- extensions/void/package.json | 2 +- extensions/void/tailwind.config.js | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/extensions/void/package.json b/extensions/void/package.json index ebccfe72116..1147f7e0857 100644 --- a/extensions/void/package.json +++ b/extensions/void/package.json @@ -69,7 +69,7 @@ "activitybar": [ { "id": "voidViewContainer", - "title": "My Extension", + "title": "Chat", "icon": "$(hubot)" } ] diff --git a/extensions/void/tailwind.config.js b/extensions/void/tailwind.config.js index 29fc6047809..0a739c8f542 100644 --- a/extensions/void/tailwind.config.js +++ b/extensions/void/tailwind.config.js @@ -1,8 +1,26 @@ /** @type {import('tailwindcss').Config} */ + +// inject user's vscode theme colors: https://code.visualstudio.com/api/extension-guides/webview#theming-webview-content module.exports = { - content: ["./src/sidebar/**/*.{html,js,ts,jsx,tsx}"], - theme: { - extend: {}, - }, - plugins: [], -} \ No newline at end of file + content: ["./src/sidebar/**/*.{html,js,ts,jsx,tsx}"], + theme: { + extend: { + colors: { + vscode: { + 'editor-bg': "var(--vscode-editor-background)", + 'editor-fg': "var(--vscode-editor-foreground)", + 'input-bg': "var(--vscode-input-background)", + 'input-fg': "var(--vscode-input-foreground)", + 'input-border': "var(--vscode-input-border)", + 'button-fg': "var(--vscode-button-foreground)", + 'button-bg': "var(--vscode-button-background)", + 'button-hoverBg': "var(--vscode-button-hoverBackground)", + 'button-secondary-fg': "var(--vscode-button-secondaryForeground)", + 'button-secondary-bg': "var(--vscode-button-secondaryBackground)", + 'button-secondary-hoverBg': "var(--vscode-button-secondaryHoverBackground)", + }, + }, + }, + }, + plugins: [], +}; From 915d041c5dc44cc5c9a2d93f9c2ad12af5424d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aneta=20Jastrz=C4=99bska?= Date: Sat, 21 Sep 2024 11:39:17 +0200 Subject: [PATCH 2/3] add default styles for input & button --- extensions/void/src/sidebar/styles.css | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/extensions/void/src/sidebar/styles.css b/extensions/void/src/sidebar/styles.css index b5c61c95671..8e6ff79f7b2 100644 --- a/extensions/void/src/sidebar/styles.css +++ b/extensions/void/src/sidebar/styles.css @@ -1,3 +1,35 @@ @tailwind base; @tailwind components; @tailwind utilities; + +html { + font-size: var(--vscode-font-size); +} + +.btn { + @apply cursor-pointer transition-colors; + + &.btn-primary { + @apply bg-vscode-button-bg text-vscode-button-fg; + + &:not(:disabled) { + @apply hover:bg-vscode-button-hoverBg; + } + } + + &.btn-secondary { + @apply bg-vscode-button-secondary-bg text-vscode-button-secondary-fg; + + &:not(:disabled) { + @apply hover:bg-vscode-button-secondary-hoverBg; + } + } + + &:disabled { + @apply opacity-75 cursor-not-allowed; + } +} + +.input { + @apply bg-vscode-input-bg text-vscode-input-fg border-vscode-input-border; +} From 49bb34ec73c1b510749c8ae1fc45260f552a2c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aneta=20Jastrz=C4=99bska?= <1544710+anetaj@users.noreply.github.com> Date: Sat, 21 Sep 2024 11:49:42 +0200 Subject: [PATCH 3/3] always show msg input; misc css improvements --- .../void/src/sidebar/MarkdownRender.tsx | 6 ++--- extensions/void/src/sidebar/Sidebar.tsx | 23 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/extensions/void/src/sidebar/MarkdownRender.tsx b/extensions/void/src/sidebar/MarkdownRender.tsx index fa59ca9aaa0..e9cc2b96ef0 100644 --- a/extensions/void/src/sidebar/MarkdownRender.tsx +++ b/extensions/void/src/sidebar/MarkdownRender.tsx @@ -7,10 +7,10 @@ import { awaitVSCodeResponse, getVSCodeAPI } from './getVscodeApi'; export const BlockCode = ({ text, disableApplyButton = false }: { text: string, disableApplyButton?: boolean }) => { return
{disableApplyButton ? null :
-
} -
+
 				{text}
 			
@@ -128,7 +128,7 @@ const Render = ({ token }: { token: Token }) => { // inline code if (t.type === "codespan") { - return {t.text}; + return {t.text}; } if (t.type === "br") { diff --git a/extensions/void/src/sidebar/Sidebar.tsx b/extensions/void/src/sidebar/Sidebar.tsx index 0107e228439..4cba1ccb31f 100644 --- a/extensions/void/src/sidebar/Sidebar.tsx +++ b/extensions/void/src/sidebar/Sidebar.tsx @@ -36,7 +36,7 @@ If you make a change, rewrite the entire file. const FilesSelector = ({ files, setFiles }: { files: vscode.Uri[], setFiles: (files: vscode.Uri[]) => void }) => { - return files.length !== 0 &&
+ return files.length !== 0 &&
Include files: {files.map((filename, i) =>
@@ -57,7 +57,7 @@ const IncludedFiles = ({ files }: { files: vscode.Uri[] }) => { {files.map((filename, i) =>