When canceling editing profile colors reset colors

This commit is contained in:
Kalle (Sendou) 2021-08-05 21:39:20 +03:00
parent ca77e56474
commit a62685e1e1

View File

@ -162,7 +162,16 @@ const ProfilePage = (props: Props) => {
) : null}
{showColorSelectors ? (
<ProfileColorSelectors
hide={() => setShowColorSelectors(false)}
hide={() => {
setShowColorSelectors(false);
const body = document.getElementsByTagName("body")[0];
for (const [key, value] of Object.entries(
user.profile?.colors ?? {}
)) {
body.style.setProperty(`--custom-${key}`, value);
}
}}
previousColors={
(user.profile?.colors as Record<string, string>) ?? undefined
}