Skip to content

Commit

Permalink
organization of Colors and util functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmanundercover committed Dec 3, 2023
1 parent d846fc5 commit f36deef
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,19 @@ import React, {FunctionComponent, PropsWithChildren, useContext, useMemo,} from
import CustomizedThemeContext from './CustomizedThemeContext';
import {CssBaseline} from "@mui/material";
import {createTheme, ThemeProvider} from "@mui/material/styles";
import {COLORS} from "../../theme/common/ColorPalette";
import {COLORS, convertToHexCode} from "../../theme/common/ColorPalette";
import {grey} from "@mui/material/colors";
import {SanityMuiFontFace, SanityMuiTheme} from "../../common/sanityIo/Types";
import PageContext from "../page-context/PageContext";
import TheWebsiteTheme from "../../theme/Theme";
import cmsClient from "../block-content-ui/cmsClient";
import capitalizeArray from "../../utils/textProcessingUtils";

type IProps = {
pageTheme?: SanityMuiTheme
};


const capitalizeArray = (theString: string[]) => {
const place = theString.map((aString) => {

const lower = aString.toLowerCase()
const upper = aString.toUpperCase()

return `"${upper[0] + lower.slice(1)}"`
})

// console.log("the capitalized array",place)
return place
}

export const convertToHexCode = (value?: string) => {
let defaultBg = COLORS.WHITESMOKE;
switch (value) {
case 'WHITESMOKE':
defaultBg = COLORS.WHITESMOKE
break;
case 'DARKBLUE':
defaultBg = COLORS.DARKBLUE
break;
case 'TRANSPARENT_DARKBLUE':
defaultBg = COLORS.TRANSPARENT_DARKBLUE
break;
case 'BLUE':
defaultBg = COLORS.BLUE
break;
case 'GRAY':
defaultBg = COLORS.GRAY
break;
case 'LIGHT_GRAY':
defaultBg = COLORS.LIGHT_GRAY
break;
case 'TRANSPARENTWHITE':
defaultBg = COLORS.TRANSPARENTWHITE
break;
case 'TRANSPARENTERWHITE':
defaultBg = COLORS.TRANSPARENTERWHITE
break;
case 'LIGHTBLUE':
defaultBg = COLORS.LIGHTBLUE
break;
case 'ALMOSTPURPLE':
defaultBg = COLORS.ALMOSTPURPLE
break;
case 'LIGHTGRAY':
defaultBg = COLORS.LIGHTGRAY
break;
case 'TRANPARENTLIGHTGRAY':
defaultBg = COLORS.TRANSPARENTLIGHTGRAY
break;
case 'MEDIUMGRAY':
defaultBg = COLORS.MEDIUMGRAY
break;
case 'DARKGRAY':
defaultBg = COLORS.DARKGRAY
break;
case 'TRANPARENTDARKGRAY':
defaultBg = COLORS.TRANSPARENTDARKGRAY
break;
case 'AQUA':
defaultBg = COLORS.AQUA
break;
case 'RED':
defaultBg = COLORS.RED
break;
case 'ALMOSTWHITE':
defaultBg = COLORS.ALMOSTWHITE
break;
case 'DARKERGRAY':
defaultBg = COLORS.DARKERGRAY
break;
// case 'DARKERGRAY':
// defaultBg = COLORS.DARKERGRAY
// break;
case 'LIGHTER_GRAY':
defaultBg = COLORS.LIGHTER_GRAY
break;
case 'DARK_GRAY':
defaultBg = COLORS.DARK_GRAY
break;
default:
defaultBg = COLORS.WHITESMOKE
}

return defaultBg
}

const CustomizedThemeProvider: FunctionComponent<IProps & PropsWithChildren> = (
props: PropsWithChildren<IProps>,
) => {
Expand Down
92 changes: 84 additions & 8 deletions src/theme/common/ColorPalette.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
export enum COLORS {
DARKBLUE = 'rgba(0,0,53,1)',
TRANSPARENT_DARKBLUE = 'rgba(0,0,53,.85)',
BLUE = 'rgba(16, 43, 136, 1)',
// DARK_GRAY = '#A8A9AC',
GRAY = 'rgba(207, 207, 207, 1)',
LIGHT_GRAY = '#949495',
TRANSPARENTWHITE = 'rgba(255,255,255,0.75)',
TRANSPARENTERWHITE = 'rgba(255,255,255,0.55)',
TRANSPARENTLIGHTGRAY = "rgba(244,243,245,0.87)",
TRANSPARENTDARKGRAY = "rgba(67,66,74,0.78)",
DARKBLUE = '#000035',
BLUE = '#102B88',
// DARK_GRAY = '#A8A9AC',
GRAY = '#CFCFCF',
LIGHT_GRAY = '#949495',
LIGHTBLUE = '#2CC4D7',
ALMOSTPURPLE = "#331BAD",
LIGHTGRAY = "#F4F3F5",
TRANSPARENTLIGHTGRAY = "rgba(244,243,245,0.87)",
MEDIUMGRAY = "#BCB9B0",
DARKGRAY = "#43424A",
TRANSPARENTDARKGRAY = "rgba(67,66,74,0.78)",
AQUA = "#12b3be",
WHITESMOKE = '#f6f6f6',
RED = "#d20027",
Expand All @@ -22,6 +22,82 @@ export enum COLORS {
DARK_GRAY = '#A8A9AC',
LIGHTER_GRAY = '#E3E3E3',
PINK = '#FFA9E7',
DARKORANGE = 'rgb(70,38,0)',
DARKORANGE = '#462600',
LIGHT_GRAY2 = '#E3E3E3',
}

export const convertToHexCode = (value?: string) => {
let defaultBg = COLORS.WHITESMOKE;
switch (value) {
case 'WHITESMOKE':
defaultBg = COLORS.WHITESMOKE
break;
case 'DARKBLUE':
defaultBg = COLORS.DARKBLUE
break;
case 'TRANSPARENT_DARKBLUE':
defaultBg = COLORS.TRANSPARENT_DARKBLUE
break;
case 'BLUE':
defaultBg = COLORS.BLUE
break;
case 'GRAY':
defaultBg = COLORS.GRAY
break;
case 'LIGHT_GRAY':
defaultBg = COLORS.LIGHT_GRAY
break;
case 'TRANSPARENTWHITE':
defaultBg = COLORS.TRANSPARENTWHITE
break;
case 'TRANSPARENTERWHITE':
defaultBg = COLORS.TRANSPARENTERWHITE
break;
case 'LIGHTBLUE':
defaultBg = COLORS.LIGHTBLUE
break;
case 'ALMOSTPURPLE':
defaultBg = COLORS.ALMOSTPURPLE
break;
case 'LIGHTGRAY':
defaultBg = COLORS.LIGHTGRAY
break;
case 'TRANPARENTLIGHTGRAY':
defaultBg = COLORS.TRANSPARENTLIGHTGRAY
break;
case 'MEDIUMGRAY':
defaultBg = COLORS.MEDIUMGRAY
break;
case 'DARKGRAY':
defaultBg = COLORS.DARKGRAY
break;
case 'TRANPARENTDARKGRAY':
defaultBg = COLORS.TRANSPARENTDARKGRAY
break;
case 'AQUA':
defaultBg = COLORS.AQUA
break;
case 'RED':
defaultBg = COLORS.RED
break;
case 'ALMOSTWHITE':
defaultBg = COLORS.ALMOSTWHITE
break;
case 'DARKERGRAY':
defaultBg = COLORS.DARKERGRAY
break;
// case 'DARKERGRAY':
// defaultBg = COLORS.DARKERGRAY
// break;
case 'LIGHTER_GRAY':
defaultBg = COLORS.LIGHTER_GRAY
break;
case 'DARK_GRAY':
defaultBg = COLORS.DARK_GRAY
break;
default:
defaultBg = COLORS.WHITESMOKE
}

return defaultBg
}
13 changes: 13 additions & 0 deletions src/utils/textProcessingUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const capitalizeArray = (theString: string[]) => {
const place = theString.map((aString) => {

const lower = aString.toLowerCase()
const upper = aString.toUpperCase()

return `"${upper[0] + lower.slice(1)}"`
})

// console.log("the capitalized array",place)
return place
}
export default capitalizeArray

0 comments on commit f36deef

Please sign in to comment.