-
Notifications
You must be signed in to change notification settings - Fork 11
feat(): support theme variant #4747
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
+91
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,8 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| applyMode as _applyMode, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getLocalAppsTheme, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| batchSetAppsLocalTheme, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setThemeVariant as _setThemeVariant, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getThemeVariant as _getThemeVariant, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from "./themeAndMode.js"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jest.spyOn(console, "error").mockImplementation(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -145,3 +147,40 @@ describe("app themes", () => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe("variant", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let setThemeVariant: typeof _setThemeVariant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let getThemeVariant: typeof _getThemeVariant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| beforeEach(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jest.resetModules(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| document.documentElement.dataset.variant = "default"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // eslint-disable-next-line @typescript-eslint/no-var-requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const m = require("./themeAndMode"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setThemeVariant = m.setThemeVariant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| getThemeVariant = m.getThemeVariant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("should set theme variant", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(getThemeVariant()).toEqual("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setThemeVariant("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(getThemeVariant()).toEqual("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("should apply the current theme variant", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(getThemeVariant()).toEqual("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setThemeVariant("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weareoutman marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("should apply the specified theme variant", () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(getThemeVariant()).toEqual("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("default"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setThemeVariant("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(getThemeVariant()).toEqual("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expect(document.documentElement.dataset.variant).toBe("elevo"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weareoutman marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+164
to
+185
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test("should set theme variant", () => { | |
| expect(getThemeVariant()).toEqual("default"); | |
| expect(document.documentElement.dataset.variant).toBe("default"); | |
| setThemeVariant("elevo"); | |
| expect(getThemeVariant()).toEqual("elevo"); | |
| expect(document.documentElement.dataset.variant).toBe("elevo"); | |
| }); | |
| test("should apply the current theme variant", () => { | |
| expect(getThemeVariant()).toEqual("default"); | |
| expect(document.documentElement.dataset.variant).toBe("default"); | |
| setThemeVariant("elevo"); | |
| expect(document.documentElement.dataset.variant).toBe("elevo"); | |
| }); | |
| test("should apply the specified theme variant", () => { | |
| expect(getThemeVariant()).toEqual("default"); | |
| expect(document.documentElement.dataset.variant).toBe("default"); | |
| setThemeVariant("elevo"); | |
| expect(getThemeVariant()).toEqual("elevo"); | |
| expect(document.documentElement.dataset.variant).toBe("elevo"); | |
| }); | |
| test("should handle theme variant correctly", () => { | |
| // Verify initial state | |
| expect(getThemeVariant()).toEqual("default"); | |
| expect(document.documentElement.dataset.variant).toBe("default"); | |
| // Set a new theme variant and verify changes | |
| setThemeVariant("elevo"); | |
| expect(getThemeVariant()).toEqual("elevo"); | |
| expect(document.documentElement.dataset.variant).toBe("elevo"); | |
| // Verify that the current theme variant is applied correctly | |
| expect(document.documentElement.dataset.variant).toBe("elevo"); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| :root { | ||
| --elevo-color-brand-rgb-channel: 37, 64, 255; | ||
| --elevo-color-brand: #2540ff; | ||
| --elevo-color-brand-hover: #5166ff; | ||
| --elevo-color-brand-active: #1e33cc; | ||
| --elevo-border-color: #ccd1de; | ||
| --elevo-border-radius: 8px; | ||
| --elevo-divider-color: rgba(222, 222, 223, 0.6); | ||
|
|
||
| --elevo-component-background: rgba(255, 255, 255, 0.73); | ||
| --elevo-component-backdrop-filter: blur(33px); | ||
|
|
||
| --elevo-input-background: rgba(255, 255, 255, 0.8); | ||
| --elevo-input-box-shadow: inset 0px -1px 3px 0px | ||
| rgba(var(--elevo-color-brand-rgb-channel), 0.5); | ||
| --elevo-placeholder-color: rgba(0, 10, 26, 0.26); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.