fix: pr review - removed any typing from primaryColor logic

pull/2522/head
William Grant 3 years ago
parent 7dd85eb55e
commit 6d919c677d

@ -7,6 +7,7 @@ import { useSelector } from 'react-redux';
import { getTheme } from '../../state/selectors/theme';
import { FixedBaseEmoji, FixedPickerProps } from '../../types/Reaction';
import {
ColorsType,
COLORS,
PrimaryColorStateType,
THEMES,
@ -56,7 +57,7 @@ export const StyledEmojiPanel = styled.div<{
--rgb-accent: ${props =>
hexColorToRGB(
props.primaryColor
? (COLORS.PRIMARY as any)[`${props.primaryColor.toUpperCase()}`]
? COLORS.PRIMARY[`${props.primaryColor.toUpperCase() as keyof ColorsType['PRIMARY']}`]
: COLORS.PRIMARY.GREEN
)};

@ -4,7 +4,7 @@
*/
// Colors
type Colors = {
export type ColorsType = {
PRIMARY: {
GREEN: string;
BLUE: string;
@ -63,7 +63,7 @@ const black = '#000000';
// Grey
const grey = '#616161';
const COLORS: Colors = {
const COLORS: ColorsType = {
PRIMARY: {
GREEN: primaryGreen,
BLUE: primaryBlue,

@ -1,7 +1,7 @@
import { find } from 'lodash';
import { Dispatch } from '@reduxjs/toolkit';
import { applyPrimaryColor } from '../state/ducks/primaryColor';
import { COLORS, getPrimaryColors, PrimaryColorStateType } from './constants/colors';
import { ColorsType, COLORS, getPrimaryColors, PrimaryColorStateType } from './constants/colors';
export function findPrimaryColorId(hexCode: string): PrimaryColorStateType | undefined {
const primaryColors = getPrimaryColors();
@ -15,7 +15,7 @@ export async function switchPrimaryColorTo(color: PrimaryColorStateType, dispatc
document.documentElement.style.setProperty(
'--primary-color',
(COLORS.PRIMARY as any)[`${color.toUpperCase()}`]
COLORS.PRIMARY[`${color.toUpperCase() as keyof ColorsType['PRIMARY']}`]
);
dispatch?.(applyPrimaryColor(color));
}

Loading…
Cancel
Save