Skip to content

Commit

Permalink
Fix color
Browse files Browse the repository at this point in the history
  • Loading branch information
genchik1 committed Feb 29, 2024
1 parent 3dbf654 commit 1d68312
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions frontend/src/components/Painting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ export const handleClick = (dataKey, state, line, setState, keyColor, rightWord,
document.getElementById('button_backspace').style.backgroundColor = cssVar("--button-color");
document.getElementById('button_backspace').style.color = cssVar("--button-text-color");

let newTextColor = keyColor;

if (tg.colorScheme === "dark") {
newTextColor = '#212121';
}

switch (dataKey) {
case 'backspace': {
if (state[line].length > 0) {
Expand Down Expand Up @@ -42,7 +36,7 @@ export const handleClick = (dataKey, state, line, setState, keyColor, rightWord,
let buttonStyle = document.getElementById(`button_${userWord[i]}`).style;
// Закрашиваем в красный цвет если такого слова не существует в базе
if (!isTrueWord) {
itemStyle.color = newTextColor;
itemStyle.color = '#fff';
itemStyle.backgroundColor = 'red';
} else {
for (let j = 0; j < userWord.length; j++) {
Expand All @@ -54,8 +48,8 @@ export const handleClick = (dataKey, state, line, setState, keyColor, rightWord,
if (buttonStyle.backgroundColor !== 'green') {
buttonStyle.backgroundColor = '#FFB74D';
}
itemStyle.color = newTextColor;
buttonStyle.color = newTextColor;
itemStyle.color = '#fff';
buttonStyle.color = '#fff';
} else {
// Закрашиваем в серый цвет
if (itemStyle.backgroundColor !== 'green' && itemStyle.backgroundColor !== '#FFB74D') {
Expand All @@ -72,9 +66,9 @@ export const handleClick = (dataKey, state, line, setState, keyColor, rightWord,
if (itemStyle.backgroundColor !== 'red') {
itemStyle.backgroundColor = 'green';
}
itemStyle.color = newTextColor;
itemStyle.color = '#fff';
buttonStyle.backgroundColor = 'green';
buttonStyle.color = newTextColor;
buttonStyle.color = '#fff';
correctLetters = correctLetters + 1
}
}
Expand Down

0 comments on commit 1d68312

Please sign in to comment.