Skip to content

Commit

Permalink
adding color & theme
Browse files Browse the repository at this point in the history
  • Loading branch information
jordantrouw committed Nov 22, 2024
1 parent b8475d1 commit 4397a3d
Show file tree
Hide file tree
Showing 28 changed files with 266 additions and 29 deletions.
1 change: 0 additions & 1 deletion .storybook/Theme/dataism/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion .storybook/Theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './xyo-website/index.ts'
export * from './dataism/index.ts'
export * from './dataism/index.ts'
export * from './xylabs/index.ts'
1 change: 0 additions & 1 deletion .storybook/Theme/xyo-website/index.ts

This file was deleted.

1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const config: StorybookConfig = {
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
// 'storybook-dark-mode',
],
framework: '@storybook/react-vite',
}
Expand Down
3 changes: 1 addition & 2 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Box, createTheme, CssBaseline, Theme, useTheme } from '@mui/material'
import type { Decorator } from '@storybook/react'
import { InvertibleMuiThemeProvider } from '@xylabs/react-invertible-theme'
import React from 'react'
import { XYOWebsiteTheme, DataismTheme } from './Theme'
import { XyLabsTheme } from '@xylabs/react-theme'
import { XYOWebsiteTheme, DataismTheme, XyLabsTheme } from '@xylabs/react-theme'

const themeNames = ['None', 'XYO', 'Dataism', 'XYLabs'] as const
type ThemeName = typeof themeNames[number]
Expand Down
37 changes: 37 additions & 0 deletions packages/theme/src/ColorCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { BoxProps } from '@mui/material'
import {
Box,
Typography, useTheme,

Check warning on line 4 in packages/theme/src/ColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'useTheme' is defined but never used
} from '@mui/material'
import React from 'react'

export interface ColorCardProps extends BoxProps {
color: string
colorName: string
subtype?: string
}

export const ColorCard: React.FC<ColorCardProps> = ({
color, colorName, subtype, ...props
}) => {
return (
<Box
display="flex"
flexDirection="column"
justifyContent="space-between"
flex="1 1 0px"
padding={2}
{...props}
>
<Box flexDirection="column">
<Typography variant="caption">{subtype}</Typography>
<Typography variant="h6">
{colorName}
</Typography>
</Box>
<Typography alignSelf="flex-end" variant="caption">
{color}
</Typography>
</Box>
)
}
28 changes: 28 additions & 0 deletions packages/theme/src/ColorShowcase.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Box } from '@mui/material'
import type { Meta, StoryFn } from '@storybook/react'
import React from 'react'

import { ColorShowcase } from './ColorShowcase.tsx'

const StorybookEntry = {
argTypes: {},
component: ColorShowcase,
parameters: { docs: { page: null }, layout: 'fullscreen' },
title: 'Theme/ColorShowcase',
} as Meta<typeof ColorShowcase>

const Template: StoryFn<typeof ColorShowcase> = () => (
<Box display="flex" height="100vh" width="100vw">
<ColorShowcase></ColorShowcase>
</Box>
)

const Default = Template.bind({})
Default.args = {
error: new Error('Test Error'),
title: 'Test Error',
}

export { Default }

export default StorybookEntry
50 changes: 50 additions & 0 deletions packages/theme/src/ColorShowcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
Box,
useTheme,
} from '@mui/material'
import React from 'react'

import { ColorCard } from './ColorCard.tsx'
import { PaletteColorCard } from './PaletteColorCard.tsx'

export const ColorShowcase: React.FC = () => {
const theme = useTheme()

return (
<Box display="flex" flexDirection="column" flex="1 1 0px">
<Box display="flex" flex="1 1 0px" flexDirection="row" justifyContent="stretch">
<ColorCard
bgcolor={theme.palette.background.default}
color={theme.palette.background.default as string}
colorName="Background"
subtype="default"
/>
<ColorCard
bgcolor={theme.palette.background.paper}
color={theme.palette.background.paper as string}
colorName="Background"
subtype="paper"
/>
<ColorCard
bgcolor={theme.palette.background.gradient}
color={theme.palette.background.gradient as string}
colorName="Gradient"
/>
</Box>
<Box display="flex" flex="1 1 0px" flexDirection="row" justifyContent="stretch">
<PaletteColorCard color={theme.palette.primary} colorName="Primary" subtype="main" />
<PaletteColorCard color={theme.palette.secondary} colorName="Secondary" subtype="main" />
<Box display="flex" flex="1 1 0px" flexDirection="column">
<Box display="flex" flex="1 1 0px" flexDirection="row">
<PaletteColorCard color={theme.palette.info} colorName="Info" subtype="main" />
<PaletteColorCard color={theme.palette.success} colorName="Success" subtype="main" />
</Box>
<Box display="flex" flex="1 1 0px" flexDirection="row">
<PaletteColorCard color={theme.palette.warning} colorName="Warning" subtype="main" />
<PaletteColorCard color={theme.palette.error} colorName="Error" subtype="main" />
</Box>
</Box>
</Box>
</Box>
)
}
29 changes: 29 additions & 0 deletions packages/theme/src/PaletteColorCard.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Box, useTheme } from '@mui/material'
import type { Meta, StoryFn } from '@storybook/react'
import React from 'react'

import type { PaletteColorCardProps } from './PaletteColorCard.tsx'
import { PaletteColorCard } from './PaletteColorCard.tsx'

const StorybookEntry = {
argTypes: {},
component: PaletteColorCard,
parameters: { docs: { page: null }, layout: 'fullscreen' },
title: 'Theme/PaletteColorCard',
} as Meta<typeof PaletteColorCard>

const Template: StoryFn<typeof PaletteColorCard> = (args: PaletteColorCardProps) => {
const theme = useTheme()
return (
<Box display="flex" height="100vh" width="100vw">
<PaletteColorCard {...args} color={theme.palette.primary} />
</Box>
)
}

const Default = Template.bind({})
Default.args = { colorName: 'Primary', subtype: 'main' }

export { Default }

export default StorybookEntry
37 changes: 37 additions & 0 deletions packages/theme/src/PaletteColorCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type {
Palette, PaletteColorOptions, PaletteOptions, SimplePaletteColorOptions,

Check warning on line 2 in packages/theme/src/PaletteColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'Palette' is defined but never used

Check warning on line 2 in packages/theme/src/PaletteColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'PaletteColorOptions' is defined but never used

Check warning on line 2 in packages/theme/src/PaletteColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'PaletteOptions' is defined but never used
TypeBackground,

Check warning on line 3 in packages/theme/src/PaletteColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'TypeBackground' is defined but never used
} from '@mui/material'
import {
Box,
Typography, useTheme,
} from '@mui/material'
import React from 'react'

export interface PaletteColorCardProps {
color: SimplePaletteColorOptions
colorName: string
subtype: keyof SimplePaletteColorOptions
}

export const PaletteColorCard: React.FC<PaletteColorCardProps> = ({
color, colorName, subtype,
}) => {
const theme = useTheme()

Check warning on line 20 in packages/theme/src/PaletteColorCard.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

'theme' is assigned a value but never used
return (
<Box
display="flex"
flexDirection="column"
justifyContent="space-between"
flex="1 1 0px"
bgcolor={color[subtype]}
padding={2}
>
<Box flexDirection="column">
<Typography variant="caption" color={color.contrastText}>{subtype}</Typography>
<Typography variant="h6" color={color.contrastText}>{colorName}</Typography>
</Box>
<Typography alignSelf="flex-end" variant="caption" color={color.contrastText}>{color[subtype]?.toString()}</Typography>
</Box>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ declare module '@mui/material/styles' {
interface PaletteOptions {
neutral?: PaletteOptions['primary']
}

interface TypeBackground {
gradient?: string
}
}

declare module '@mui/material/Button' {
Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/ThemeExtensions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './customThemeColors.ts'
28 changes: 28 additions & 0 deletions packages/theme/src/ThemeShowcase.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Box } from '@mui/material'
import type { Meta, StoryFn } from '@storybook/react'
import React from 'react'

import { ThemeShowcase } from './ThemeShowcase.tsx'

const StorybookEntry = {
argTypes: {},
component: ThemeShowcase,
parameters: { docs: { page: null } },
title: 'Theme/ThemeShowcase',
} as Meta<typeof ThemeShowcase>

const Template: StoryFn<typeof ThemeShowcase> = () => (
<Box height="100vh" width="100vw">
<ThemeShowcase></ThemeShowcase>
</Box>
)

const Default = Template.bind({})
Default.args = {
error: new Error('Test Error'),
title: 'Test Error',
}

export { Default }

export default StorybookEntry
15 changes: 15 additions & 0 deletions packages/theme/src/ThemeShowcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {
Box,
Typography,
} from '@mui/material'
import React from 'react'

export const ThemeShowcase: React.FC = () => {
return (
<Box>
<Typography variant="h4" gutterBottom>
XYO Website Theme Showcase
</Typography>
</Box>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import type { ColorSystemOptions } from '@mui/material'
import { personaColorsDarkMode } from './customThemeColors.tsx'

export const darkThemePalette: ColorSystemOptions['palette'] = {
background: { paper: '#1E1E1E' },
background: { paper: '#1E1E1E', gradient: 'linear-gradient(to right, #fff, #66caf7)' },
info: { main: '#72b4f4' },
mode: 'dark',
primary: { main: '#fff' },
secondary: {
main: '#66caf7',
Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/dataism/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './theme.tsx'
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import type { ColorSystemOptions } from '@mui/material'
import { personaColorsLightMode } from './customThemeColors.tsx'

export const lightThemePalette: ColorSystemOptions['palette'] = {
background: { paper: '#FAFAFA' },
background: { paper: '#FAFAFA', gradient: 'linear-gradient(to right, #000, #186ecc)' },
info: { main: '#72b4f4' },
mode: 'light',
primary: { main: '#000' },
secondary: { main: '#186ecc' },
success: { main: '#48BA4B', contrastText: '#fff' },
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/theme/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './darkThemeOptions.ts'
export * from './lightThemeOptions.ts'
export * from './theme.ts'
export * from './dataism/index.ts'
export * from './xylabs/index.ts'
export * from './xyo-website/index.ts'
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export const darkThemeOptions: ThemeOptions = {
background: {
default: '#0b0f30',
paper: '#101742',
gradient: 'linear-gradient(to right, #384AFD, #FFC91D)',
},
mode: 'dark',
text: {
disabled: '#a5acdb',
primary: '#f7f8fc',
Expand Down
1 change: 1 addition & 0 deletions packages/theme/src/xylabs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './theme.tsx'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { ThemeOptions } from '@mui/material'

export const lightThemeOptions: ThemeOptions = {
palette: {
background: { gradient: 'linear-gradient(to right, #384AFD, #FFC91D)' },
info: { main: '#2733B1' },
mode: 'light',
primary: {
dark: '#010965',
light: '#EBECFF',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createTheme, type Theme } from '@mui/material'

import { darkThemeOptions } from './darkThemeOptions.ts'
import { lightThemeOptions } from './lightThemeOptions.ts'
import { darkThemeOptions } from './darkThemeOptions.tsx'
import { lightThemeOptions } from './lightThemeOptions.tsx'

export const XyLabsTheme: Theme = createTheme({
colorSchemes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import {
alpha, lighten, type ThemeOptions,
} from '@mui/material'

import { neutralButtonStylesContained, neutralButtonStylesOutlined } from './customThemeColors.ts'
import { neutralButtonStylesContained, neutralButtonStylesOutlined } from '../ThemeExtensions/customThemeColors.ts'

Check warning on line 5 in packages/theme/src/xyo-website/darkThemeOptions.tsx

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 22.3.0)

Reaching to "../ThemeExtensions/customThemeColors.ts" is not allowed

export const darkThemeOptions: ThemeOptions = {
palette: {
background: {
default: '#020223',
paper: '#16163D',
gradient: 'linear-gradient(to right, #66caf7, #5658F3)',
},
neutral: {
main: '#fff',
contrastText: '#000',
},
info: { main: '#72b4f4' },
mode: 'dark',
primary: { main: '#5658F3' },
secondary: {
main: '#66caf7',
Expand Down Expand Up @@ -83,13 +86,6 @@ export const darkThemeOptions: ThemeOptions = {
},
},
},
MuiTable: {
styleOverrides:{
root: {
background: '#20205A'
},
}
},
MuiTable: { styleOverrides: { root: { background: '#20205A' } } },
},
}

1 change: 1 addition & 0 deletions packages/theme/src/xyo-website/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './theme.ts'
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { alpha, ThemeOptions } from '@mui/material'
import type { ThemeOptions } from '@mui/material'
import { alpha } from '@mui/material'

export const lightThemeOptions: ThemeOptions = {
palette: {
background: { paper: '#FAFAFA' },
background: {
paper: '#FAFAFA',
gradient: 'linear-gradient(to right, #72b4f4, #463dc6)',
},
neutral: {
contrastText: '#fff',
contrastText: '#fff',
main: '#000',
},
info: { main: '#72b4f4' },
Expand Down
Loading

0 comments on commit 4397a3d

Please sign in to comment.