Skip to content

Commit

Permalink
chore(components): Add missing ramda package
Browse files Browse the repository at this point in the history
Signed-off-by: Antonette Caldwell <[email protected]>
  • Loading branch information
nebula-aac committed Oct 2, 2023
1 parent 16f917f commit 253874d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/theme/SistentProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SistentProviderContextType>({
theme: DEFAULT_THEME
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/theme/types/SistentTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SISTENT_SIZES = {
xl: null
};

type ThemeComponent = {};
interface ThemeComponent {}

export type SistentThemeOther = Record<string, any>;
export type SistentThemeComponents = Record<string, ThemeComponent>;
Expand Down Expand Up @@ -44,7 +44,7 @@ const HeadingsType = t.type({
})
});

const ShadeType = t.keyof({
export const ShadeType = t.keyof({
'0': null,
'1': null,
'2': null,
Expand Down
14 changes: 10 additions & 4 deletions packages/components/src/theme/utils/primaryShade.ts
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 253874d

Please sign in to comment.