mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
fix: pr review - remove unneeded useState and useEffect in SessionEmojiPanel
This commit is contained in:
parent
be21f29875
commit
172510d11b
1 changed files with 23 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { forwardRef, useEffect, useState } from 'react';
|
||||
import React, { forwardRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import styled from 'styled-components';
|
||||
// @ts-ignore
|
||||
|
@ -103,31 +103,29 @@ export const SessionEmojiPanel = forwardRef<HTMLDivElement, Props>((props: Props
|
|||
const theme = useSelector(getTheme);
|
||||
const isDarkMode = useSelector(isDarkTheme);
|
||||
|
||||
const [panelBackgroundRGB, setPanelBackgroundRGB] = useState('');
|
||||
const [panelTextRGB, setPanelTextRGB] = useState('');
|
||||
let panelBackgroundRGB = hexColorToRGB(THEMES.CLASSIC_DARK.COLOR1);
|
||||
let panelTextRGB = hexColorToRGB(THEMES.CLASSIC_DARK.COLOR6);
|
||||
|
||||
useEffect(() => {
|
||||
switch (theme) {
|
||||
case 'ocean-dark':
|
||||
setPanelBackgroundRGB(hexColorToRGB(THEMES.OCEAN_DARK.COLOR1));
|
||||
// tslint:disable: no-non-null-assertion
|
||||
setPanelTextRGB(hexColorToRGB(THEMES.OCEAN_DARK.COLOR7!));
|
||||
break;
|
||||
case 'ocean-light':
|
||||
// tslint:disable: no-non-null-assertion
|
||||
setPanelBackgroundRGB(hexColorToRGB(THEMES.OCEAN_LIGHT.COLOR7!));
|
||||
setPanelTextRGB(hexColorToRGB(THEMES.OCEAN_LIGHT.COLOR1));
|
||||
break;
|
||||
case 'classic-light':
|
||||
setPanelBackgroundRGB(hexColorToRGB(THEMES.CLASSIC_LIGHT.COLOR6));
|
||||
setPanelTextRGB(hexColorToRGB(THEMES.CLASSIC_LIGHT.COLOR0));
|
||||
break;
|
||||
case 'classic-dark':
|
||||
default:
|
||||
setPanelBackgroundRGB(hexColorToRGB(THEMES.CLASSIC_DARK.COLOR1));
|
||||
setPanelTextRGB(hexColorToRGB(THEMES.CLASSIC_DARK.COLOR6));
|
||||
}
|
||||
}, [theme]);
|
||||
switch (theme) {
|
||||
case 'ocean-dark':
|
||||
panelBackgroundRGB = hexColorToRGB(THEMES.OCEAN_DARK.COLOR1);
|
||||
// tslint:disable: no-non-null-assertion
|
||||
panelTextRGB = hexColorToRGB(THEMES.OCEAN_DARK.COLOR7!);
|
||||
break;
|
||||
case 'ocean-light':
|
||||
// tslint:disable: no-non-null-assertion
|
||||
panelBackgroundRGB = hexColorToRGB(THEMES.OCEAN_LIGHT.COLOR7!);
|
||||
panelTextRGB = hexColorToRGB(THEMES.OCEAN_LIGHT.COLOR1);
|
||||
break;
|
||||
case 'classic-light':
|
||||
panelBackgroundRGB = hexColorToRGB(THEMES.CLASSIC_LIGHT.COLOR6);
|
||||
panelTextRGB = hexColorToRGB(THEMES.CLASSIC_LIGHT.COLOR0);
|
||||
break;
|
||||
case 'classic-dark':
|
||||
default:
|
||||
panelBackgroundRGB = hexColorToRGB(THEMES.CLASSIC_DARK.COLOR1);
|
||||
panelTextRGB = hexColorToRGB(THEMES.CLASSIC_DARK.COLOR6);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledEmojiPanel
|
||||
|
|
Loading…
Reference in a new issue