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

WIP Chat 2 #389

Open
wants to merge 29 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use getThemeColorsSync
  • Loading branch information
pomber committed Jun 25, 2023
commit 83a6bb130f90d054edbb8adb065536d366b1dc1c
2 changes: 1 addition & 1 deletion packages/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"coverage": "vitest run --coverage"
},
"dependencies": {
"@code-hike/lighter": "0.7.0",
"@code-hike/lighter": "0.7.1",
"node-fetch": "^2.0.0",
"react-markdown": "^8.0.7"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/mdx/pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ console.log("this 5oo")


That is bar.

---

- foo
- bar bax
`,
},
{
Expand Down
24 changes: 12 additions & 12 deletions packages/mdx/src/chat/chat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@
gap: 10px;
}

.ch-scrollycoding-content p {
margin: 1.5rem 0;
}

.ch-scrollycoding-content p:last-child {
margin-bottom: 0;
}

.ch-scrollycoding-content p:first-child {
margin-top: 0;
}

.ch-scrollycoding-step-content {
border-radius: 18px !important;
padding: 0px !important;
Expand Down Expand Up @@ -93,6 +81,18 @@
line-height: 1.5;
}

.ch-chat-message p {
margin: 1.5rem 0;
}

.ch-chat-message p:last-child {
margin-bottom: 0;
}

.ch-chat-message p:first-child {
margin-top: 0;
}

.ch-chat-question {
background-color: #0084ff;
border-bottom-right-radius: 3px;
Expand Down
43 changes: 3 additions & 40 deletions packages/mdx/src/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
Theme,
RawTheme,
getThemeColors,
getThemeColorsSync,
} from "@code-hike/lighter/dist/browser.esm.mjs"

const styleCache = new Map<string, string>()
Expand Down Expand Up @@ -49,8 +50,8 @@ async function getCSSVariables(theme: Theme) {
return rules
}

export async function getCSSVariablesObject(theme: Theme) {
const themeColors = await getThemeColors(theme)
export function getCSSVariablesObjectSync(theme: RawTheme) {
const themeColors = getThemeColorsSync(theme)
const rules: Record<string, string> = {}
if (!themeColors || typeof themeColors !== "object") {
throw new Error(
Expand All @@ -76,43 +77,5 @@ export async function getCSSVariablesObject(theme: Theme) {
}
}
}
console.log(rules)
return rules
}

export function getCSSVariablesObjectSync(theme: RawTheme) {
// TODO create sync function in lighter
return {
"--ch-t-colorScheme": "dark",
"--ch-t-foreground": "#c9d1d9",
"--ch-t-background": "#0d1117",
"--ch-t-lighter-inlineBackground": "#0d1117e6",
"--ch-t-editor-background": "#0d1117",
"--ch-t-editor-foreground": "#c9d1d9",
"--ch-t-editor-lineHighlightBackground": "#6e76811a",
"--ch-t-editor-rangeHighlightBackground": "#ffffff0b",
"--ch-t-editor-infoForeground": "#3794FF",
"--ch-t-editor-selectionBackground": "#264F78",
"--ch-t-focusBorder": "#1f6feb",
"--ch-t-tab-activeBackground": "#0d1117",
"--ch-t-tab-activeForeground": "#c9d1d9",
"--ch-t-tab-inactiveBackground": "#010409",
"--ch-t-tab-inactiveForeground": "#8b949e",
"--ch-t-tab-border": "#30363d",
"--ch-t-tab-activeBorder": "#0d1117",
"--ch-t-editorGroup-border": "#30363d",
"--ch-t-editorGroupHeader-tabsBackground": "#010409",
"--ch-t-editorLineNumber-foreground": "#6e7681",
"--ch-t-input-background": "#0d1117",
"--ch-t-input-foreground": "#c9d1d9",
"--ch-t-input-border": "#30363d",
"--ch-t-icon-foreground": "#8b949e",
"--ch-t-sideBar-background": "#010409",
"--ch-t-sideBar-foreground": "#c9d1d9",
"--ch-t-sideBar-border": "#30363d",
"--ch-t-list-activeSelectionBackground": "#6e768166",
"--ch-t-list-activeSelectionForeground": "#c9d1d9",
"--ch-t-list-hoverBackground": "#6e76811a",
"--ch-t-list-hoverForeground": "#c9d1d9",
}
}
Loading