Skip to content

🪟 🎨 Connector Builder light yaml editor theme #19100

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

Merged
merged 7 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

.modalContent {
height: 60vh;
background-color: colors.$dark-blue;
overflow: visible;
background-color: colors.$grey-100;
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const ConfigMenu: React.FC<ConfigMenuProps> = ({ className }) => {
<CodeEditor
value={configString}
language="json"
theme="airbyte"
theme="airbyte-light"
onChange={(val: string | undefined) => {
setConfigString(val ?? "");
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

.control {
flex: 0 0 auto;
background-color: colors.$dark-blue;
background-color: transparent;
display: flex;
padding: variables.$spacing-md;
flex-direction: row;
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/components/YamlEditor/YamlEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const YamlEditor: React.FC = () => {
<CodeEditor
value={yamlManifest}
language="yaml"
theme="airbyte"
theme="airbyte-light"
onChange={(value: string | undefined) => setYamlManifest(value ?? "")}
lineNumberCharacterWidth={6}
/>
Expand Down
17 changes: 12 additions & 5 deletions airbyte-webapp/src/components/ui/CodeEditor/CodeEditor.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

// Export colors to be used in monaco editor
:export {
tokenString: colors.$white;
tokenType: colors.$blue-300;
tokenNumber: colors.$orange-300;
tokenDelimiter: colors.$yellow-300;
tokenKeyword: colors.$green-300;
darkString: colors.$white;
darkType: colors.$blue-300;
darkNumber: colors.$orange-300;
darkDelimiter: colors.$yellow-300;
darkKeyword: colors.$green-300;
lightString: colors.$dark-blue;
lightType: colors.$blue-500;
lightNumber: colors.$orange-600;
lightDelimiter: colors.$black;
lightKeyword: colors.$green-600;
lightLineNumber: colors.$dark-blue-300;
lightLineNumberActive: colors.$dark-blue;
}
37 changes: 29 additions & 8 deletions airbyte-webapp/src/components/ui/CodeEditor/CodeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from "./CodeEditor.module.scss";
interface CodeEditorProps {
value: string;
language?: string;
theme?: "airbyte" | "vs-dark" | "light";
theme?: "airbyte-dark" | "airbyte-light" | "vs-dark" | "light";
readOnly?: boolean;
onChange?: (value: string | undefined) => void;
height?: string;
Expand All @@ -33,22 +33,43 @@ export const CodeEditor: React.FC<CodeEditorProps> = ({
lineNumberCharacterWidth,
}) => {
const setAirbyteTheme = (monaco: Monaco) => {
monaco.editor.defineTheme("airbyte", {
monaco.editor.defineTheme("airbyte-dark", {
base: "vs-dark",
inherit: true,
rules: [
{ token: "string", foreground: expandHexValue(styles.tokenString) },
{ token: "type", foreground: expandHexValue(styles.tokenType) },
{ token: "number", foreground: expandHexValue(styles.tokenNumber) },
{ token: "delimiter", foreground: expandHexValue(styles.tokenDelimiter) },
{ token: "keyword", foreground: expandHexValue(styles.tokenKeyword) },
{ token: "string", foreground: expandHexValue(styles.darkString) },
{ token: "string.yaml", foreground: expandHexValue(styles.darkString) },
{ token: "string.value.json", foreground: expandHexValue(styles.darkType) },
{ token: "string.key.json", foreground: expandHexValue(styles.darkType) },
{ token: "type", foreground: expandHexValue(styles.darkType) },
{ token: "number", foreground: expandHexValue(styles.darkNumber) },
{ token: "delimiter", foreground: expandHexValue(styles.darkDelimiter) },
{ token: "keyword", foreground: expandHexValue(styles.darkKeyword) },
],
colors: {
"editor.background": "#00000000", // transparent, so that parent background is shown instead
},
});

monaco.editor.setTheme("airbyte");
monaco.editor.defineTheme("airbyte-light", {
base: "vs",
inherit: true,
rules: [
{ token: "string", foreground: expandHexValue(styles.lightString) },
{ token: "string.yaml", foreground: expandHexValue(styles.lightString) },
{ token: "string.value.json", foreground: expandHexValue(styles.lightString) },
{ token: "string.key.json", foreground: expandHexValue(styles.lightType) },
{ token: "type", foreground: expandHexValue(styles.lightType) },
{ token: "number", foreground: expandHexValue(styles.lightNumber) },
{ token: "delimiter", foreground: expandHexValue(styles.lightDelimiter) },
{ token: "keyword", foreground: expandHexValue(styles.lightKeyword) },
],
colors: {
"editor.background": "#00000000", // transparent, so that parent background is shown instead
"editorLineNumber.foreground": expandHexValue(styles.lightLineNumber),
"editorLineNumber.activeForeground": expandHexValue(styles.lightLineNumberActive),
},
});
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
}

.container {
background-image: linear-gradient(colors.$dark-blue-900, colors.$dark-blue-1000);
background-image: linear-gradient(colors.$grey-50, colors.$grey-100);
}
3 changes: 1 addition & 2 deletions airbyte-webapp/src/views/common/StoreProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { ReactQueryDevtools } from "react-query/devtools";

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -15,7 +14,7 @@ const queryClient = new QueryClient({

const StoreProvider: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => (
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools initialIsOpen={false} position="bottom-right" />
{/* <ReactQueryDevtools initialIsOpen={false} position="bottom-right" /> */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specific reason we commented this out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, didn't mean to commit that. I had just commented it out while taking a screenshot to not detract from the color-focused demonstration :p

Will undo this

{children}
</QueryClientProvider>
);
Expand Down