-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2628 from evidence-dev/feat/2499-theming
Theming & Appearances
- Loading branch information
Showing
318 changed files
with
7,806 additions
and
4,827 deletions.
There are no files selected for viewing
This file contains 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,10 @@ | ||
--- | ||
'@evidence-dev/evidence': major | ||
'@evidence-dev/component-utilities': major | ||
'@evidence-dev/preprocess': major | ||
'@evidence-dev/sdk': major | ||
'@evidence-dev/core-components': major | ||
'@evidence-dev/tailwind': major | ||
--- | ||
|
||
Theming & Appearances |
This file contains 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,5 @@ | ||
--- | ||
'@evidence-dev/icons': patch | ||
--- | ||
|
||
Icons use currentColor instead of hardcoded color |
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,2 +1,17 @@ | ||
<div data-testid="div-with-background" class="w-20 h-20 bg-mySemanticColor"> | ||
<div data-testid="div-primary-class" class="bg-primary"> | ||
div-primary-class | ||
</div> | ||
|
||
<div data-testid="div-primary-var" style="background: var(--primary)"> | ||
div-primary-var | ||
</div> | ||
|
||
<div data-testid="div-myCustomColor-class" class="bg-myCustomColor"> | ||
div-myCustomColor-class | ||
</div> | ||
|
||
<div data-testid="div-myCustomColor-var" style="background: var(--myCustomColor)"> | ||
div-myCustomColor-var | ||
</div> | ||
|
||
This is some body text |
This file contains 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 |
---|---|---|
@@ -1,23 +1,51 @@ | ||
// @ts-check | ||
import { test, expect } from '@playwright/test'; | ||
import { waitForPageToLoad } from '../../test-utils'; | ||
import { switchAppearance, waitForPageToLoad } from '../../test-utils'; | ||
|
||
test('should change color based on theme', async ({ page }) => { | ||
test('should change colors based on theme', async ({ page }) => { | ||
await page.goto('/'); | ||
await waitForPageToLoad(page); | ||
|
||
const divWithBackground = await page.getByTestId('div-with-background'); | ||
const divPrimaryClass = await page.getByTestId('div-primary-class'); | ||
const divPrimaryVar = await page.getByTestId('div-primary-var'); | ||
const divMyCustomColorClass = await page.getByTestId('div-myCustomColor-class'); | ||
const divMyCustomColorVar = await page.getByTestId('div-myCustomColor-var'); | ||
|
||
// Starts with system theme (dark) | ||
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await switchAppearance(page, 'system'); | ||
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(254, 220, 186)'); | ||
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(254, 220, 186)'); | ||
|
||
await page.getByLabel('Menu').click(); | ||
await switchAppearance(page, 'light'); | ||
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(255, 0, 0)'); | ||
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(255, 0, 0)'); | ||
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(171, 205, 239)'); | ||
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(171, 205, 239)'); | ||
|
||
// Light theme | ||
await page.getByRole('menuitem', { name: 'Appearance' }).click(); | ||
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(255, 0, 0)'); | ||
await switchAppearance(page, 'dark'); | ||
await expect(divPrimaryClass).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await expect(divPrimaryVar).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await expect(divMyCustomColorClass).toHaveCSS('background-color', 'rgb(254, 220, 186)'); | ||
await expect(divMyCustomColorVar).toHaveCSS('background-color', 'rgb(254, 220, 186)'); | ||
}); | ||
|
||
test('body text should be computed from base', async ({ page }) => { | ||
await page.goto('/'); | ||
await waitForPageToLoad(page); | ||
|
||
const body = await page.locator('body'); | ||
const text = await page.getByText('This is some body text'); | ||
|
||
await switchAppearance(page, 'system'); | ||
await expect(text).toHaveCSS('color', 'rgb(205, 200, 206)'); | ||
await expect(body).toHaveCSS('background-color', 'rgb(23, 1, 24)'); | ||
|
||
await switchAppearance(page, 'light'); | ||
await expect(text).toHaveCSS('color', 'rgb(45, 42, 46)'); | ||
await expect(body).toHaveCSS('background-color', 'rgb(253, 244, 255)'); | ||
|
||
// Dark theme | ||
await page.getByRole('menuitem', { name: 'Appearance' }).click(); | ||
await expect(divWithBackground).toHaveCSS('background-color', 'rgb(0, 255, 0)'); | ||
await switchAppearance(page, 'dark'); | ||
await expect(text).toHaveCSS('color', 'rgb(205, 200, 206)'); | ||
await expect(body).toHaveCSS('background-color', 'rgb(23, 1, 24)'); | ||
}); |
This file contains 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 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,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"types": ["@evidence-dev/tailwind"] | ||
} | ||
} |
This file contains 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 was deleted.
Oops, something went wrong.
Oops, something went wrong.