From 253874df76fd0748b70689094a1937c78b099726 Mon Sep 17 00:00:00 2001 From: Antonette Caldwell <134739862+nebula-aac@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:31:57 +0000 Subject: [PATCH] chore(components): Add missing ramda package Signed-off-by: Antonette Caldwell <134739862+nebula-aac@users.noreply.github.com> --- packages/components/package.json | 1 + packages/components/src/theme/SistentProvider.tsx | 8 ++++---- .../components/src/theme/types/SistentTheme.ts | 4 ++-- .../components/src/theme/utils/primaryShade.ts | 14 ++++++++++---- yarn.lock | 1 + 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/components/package.json b/packages/components/package.json index 44931fa5..85bfdfc6 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -18,6 +18,7 @@ "@layer5/sistent-svg": "0.6.6" }, "devDependencies": { + "@emotion/react": "^11.11.1", "@mui/material": "^5.14.10", "@types/ramda": "^0.29.3", "@types/react": "^18.2.15", diff --git a/packages/components/src/theme/SistentProvider.tsx b/packages/components/src/theme/SistentProvider.tsx index e7d7e0ca..0d881a5a 100644 --- a/packages/components/src/theme/SistentProvider.tsx +++ b/packages/components/src/theme/SistentProvider.tsx @@ -5,10 +5,10 @@ import { DEFAULT_THEME } from './defaultTheme'; import { SistentTheme, SistentThemeOverride } from './types/SistentTheme'; import { mergeThemeWithFn } from './utils/mergeTheme'; -type SistentProviderContextType = { +interface SistentProviderContextType { theme: SistentTheme; emotionCache?: EmotionCache; -}; +} const SistentProviderContext = createContext({ theme: DEFAULT_THEME @@ -34,12 +34,12 @@ export function useSistentEmotionCache() { return useContext(SistentProviderContext)?.emotionCache; } -export type SistentProviderProps = { +export interface SistentProviderProps { theme?: SistentThemeOverride; emotionCache?: EmotionCache; children: ReactNode; inherit?: boolean; -}; +} export function SistentProvider({ theme, diff --git a/packages/components/src/theme/types/SistentTheme.ts b/packages/components/src/theme/types/SistentTheme.ts index 41586cbd..434a3cb9 100644 --- a/packages/components/src/theme/types/SistentTheme.ts +++ b/packages/components/src/theme/types/SistentTheme.ts @@ -12,7 +12,7 @@ const SISTENT_SIZES = { xl: null }; -type ThemeComponent = {}; +interface ThemeComponent {} export type SistentThemeOther = Record; export type SistentThemeComponents = Record; @@ -44,7 +44,7 @@ const HeadingsType = t.type({ }) }); -const ShadeType = t.keyof({ +export const ShadeType = t.keyof({ '0': null, '1': null, '2': null, diff --git a/packages/components/src/theme/utils/primaryShade.ts b/packages/components/src/theme/utils/primaryShade.ts index 678d6730..361ca016 100644 --- a/packages/components/src/theme/utils/primaryShade.ts +++ b/packages/components/src/theme/utils/primaryShade.ts @@ -1,10 +1,16 @@ -import { SistentThemeBase } from '../types/SistentTheme'; +import { ShadeType, SistentTheme, SistentThemeBase } from '../types/SistentTheme'; -export function primaryShade(theme: SistentThemeBase) { +/* +export function primaryShade(theme: SistentThemeBase): (colorScheme?: 'light' | 'dark') => typeof ShadeType { return (colorScheme?: 'light' | 'dark') => { if (typeof theme.primaryShade === 'number') { - return theme.primaryShade; + // You can return a default ShadeType value here if needed + return '0' as unknown as typeof ShadeType; // or any other default value from ShadeType } - return theme.primaryShade[colorScheme || theme.colorScheme]; + // Use a type assertion here to tell TypeScript that you know it's safe + return (theme.primaryShade as unknown as { [key in 'light' | 'dark']: typeof ShadeType })[colorScheme ?? theme.colorScheme]; }; } +*/ + +export function primaryShade(theme: SistentTheme, colorScheme: SistentThemeColors) \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 9e11133c..54765951 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2196,6 +2196,7 @@ __metadata: version: 0.0.0-use.local resolution: "@layer5/sistent-components@workspace:packages/components" dependencies: + "@emotion/react": ^11.11.1 "@layer5/sistent-svg": 0.6.6 "@mui/material": ^5.14.10 "@types/ramda": ^0.29.3