Skip to content

Commit

Permalink
- Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck Cornu committed Jan 15, 2024
1 parent 90eab91 commit 00e3885
Show file tree
Hide file tree
Showing 4 changed files with 318 additions and 27 deletions.
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@microsoft/fast-colors": "5.3.1",
"@microsoft/fast-components": "2.30.6",
"@microsoft/fast-element": "1.12.0",
"@microsoft/fast-foundation": "2.49.1",
"@microsoft/fast-foundation": "2.49.4",
"@microsoft/mgt": "3.1.3",
"@microsoft/mgt-components": "3.1.3",
"@microsoft/mgt-element": "3.1.3",
Expand Down Expand Up @@ -144,8 +144,8 @@
"postcss-loader": "7.0.1",
"postcss-nested": "^6.0.1",
"postcss-preset-env": "7.8.3",
"puppeteer": "20.0.0",
"puppeteer-core": "20.0.0",
"puppeteer": "21.7.0",
"puppeteer-core": "21.7.0",
"prettier": "2.8.3",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
23 changes: 12 additions & 11 deletions packages/components/src/components/BaseComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { property, state } from "lit/decorators.js";
import { ErrorTypes, ThemeDefaultCSSVariablesValues, ThemeInternalCSSVariables, ThemePublicCSSVariables } from "../common/Constants";
import { IComponentBinding } from "../models/common/IComponentBinding";
import { IThemeDefinition } from "../models/common/IThemeDefinition";
import { isEqual, isObjectLike } from "lodash-es";
import { isEmpty, isEqual, isObjectLike } from "lodash-es";
import { ILocalizedString } from "../models/common/ILocalizedString";
import { ScopedElementsMixin } from "@open-wc/scoped-elements";
import "@open-wc/dedupe-mixin";
Expand Down Expand Up @@ -283,12 +283,14 @@ export abstract class BaseComponent extends ScopedElementsMixin(MgtTemplatedComp
}

private setFASTColors() {

const theme = this.getTheme();

if (theme.isDarkMode) {
const primaryBackgroundColor = getComputedStyle(this).getPropertyValue(ThemeInternalCSSVariables.primaryBackgroundColorDark);

baseLayerLuminance.setValueFor(this,StandardLuminance.DarkMode);
neutralFillRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(getComputedStyle(this).getPropertyValue(ThemeInternalCSSVariables.primaryBackgroundColorDark))));
neutralFillRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(primaryBackgroundColor) ? parseColorHexRGB(primaryBackgroundColor) : parseColorHexRGB(ThemeDefaultCSSVariablesValues.primaryBackgroundColorDark)));
neutralFillStealthRest.setValueFor(this, neutralFillRest);
neutralFillStealthRestFluent.setValueFor(this, neutralFillRest);
} else {
Expand All @@ -298,15 +300,14 @@ export abstract class BaseComponent extends ScopedElementsMixin(MgtTemplatedComp
}

const primaryColor = getComputedStyle(this).getPropertyValue(ThemeInternalCSSVariables.colorPrimary);
let defaultColor = primaryColor;
if (!primaryColor) {
defaultColor = ThemeDefaultCSSVariablesValues.defaultColorPrimary;
const defaultPrimaryColor: string = !isEmpty(primaryColor) ? primaryColor : ThemeDefaultCSSVariablesValues.defaultColorPrimary.toString();

if (parseColorHexRGB(defaultPrimaryColor)) {
accentFillRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultPrimaryColor)));
accentFillHover.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultPrimaryColor)));
accentForegroundRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultPrimaryColor)));
accentFillActive.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultPrimaryColor)));
}

accentFillRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultColor)));
accentFillHover.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultColor)));
accentForegroundRest.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultColor)));
accentFillActive.setValueFor(this, SwatchRGB.from(parseColorHexRGB(defaultColor)));
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
3 changes: 0 additions & 3 deletions packages/components/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = {
darkMode: "class",
theme: {
extend: {
gridTemplateColumns: {
"searchResult": "32px 2fr 0fr"
},
fontFamily: {
primary: ["var(--pnpsearch-internal-fontFamilyPrimary)","'Segoe UI'", "'Arial, sans-serif'"],
sans: ["var(--pnpsearch-internal-fontFamilySecondary)", "Roboto", ...defaultTheme.fontFamily.sans]
Expand Down
Loading

0 comments on commit 00e3885

Please sign in to comment.