feat(wordsearch): плотные градиенты клеток + фиолетовые кнопки

This commit is contained in:
2026-09-30 14:40:56 +03:00
parent 05ec7ceba4
commit 9464ccf6e1
3 changed files with 60 additions and 40 deletions
+21 -19
View File
@@ -1,5 +1,5 @@
import { useState, useRef, useCallback, useEffect, memo, useMemo } from 'react'; import { useState, useRef, useCallback, useEffect, memo, useMemo } from 'react';
import { colors, radius, shadows } from '../styles/theme'; import { colors, radius, shadows, cellShadows } from '../styles/theme';
interface CellProps { interface CellProps {
letter: string; letter: string;
@@ -13,6 +13,8 @@ interface CellProps {
} }
const Cell = memo<CellProps>(({ letter, size, fontSize, bg, border, textColor, boxShadow, animation }) => { const Cell = memo<CellProps>(({ letter, size, fontSize, bg, border, textColor, boxShadow, animation }) => {
// 🔧 ФИКС (30.09.2026): градиенты без бордера (или тонкий полупрозрачный)
const isGradient = typeof bg === 'string' && bg.startsWith('linear-gradient');
return ( return (
<div <div
style={{ style={{
@@ -23,16 +25,17 @@ const Cell = memo<CellProps>(({ letter, size, fontSize, bg, border, textColor, b
justifyContent: 'center', justifyContent: 'center',
borderRadius: radius.sm, borderRadius: radius.sm,
background: bg, background: bg,
border: `2px solid ${border}`, border: isGradient ? 'none' : `2px solid ${border}`,
color: textColor, color: textColor,
fontSize: `${fontSize}px`, fontSize: `${fontSize}px`,
fontWeight: bg !== colors.cellDefault ? 700 : 500, fontWeight: 700,
fontFamily: 'Inter, sans-serif', fontFamily: 'Inter, sans-serif',
transition: animation ? 'all 0.3s ease' : 'all 0.15s ease', transition: animation ? 'all 0.3s ease' : 'all 0.15s ease',
pointerEvents: 'none', pointerEvents: 'none',
boxShadow: boxShadow, boxShadow: boxShadow,
animation: animation || undefined, animation: animation || undefined,
willChange: bg !== colors.cellDefault ? 'transform, box-shadow' : 'auto', willChange: 'transform, box-shadow',
textShadow: isGradient ? '0 1px 2px rgba(0,0,0,0.15)' : 'none',
}} }}
> >
{letter} {letter}
@@ -304,30 +307,29 @@ const LetterGrid: React.FC<LetterGridProps> = ({
const found = foundCells.has(key); const found = foundCells.has(key);
const newFound = newFoundCells.has(key); const newFound = newFoundCells.has(key);
let bg = colors.cellDefault; // 🔧 ОБНОВЛЕНО (30.09.2026): плотные градиенты + белые буквы.
let border = colors.border; let bg = colors.cellDefault; // фиолетовый градиент
let textColor = colors.text; let border = 'transparent';
let textColor = '#FFFFFF'; // всегда белый
let animation = ''; let animation = '';
let boxShadow = shadows.cell; let boxShadow = cellShadows.default;
if (found) { if (found) {
bg = colors.cellFound; bg = colors.cellFound; // зелёный градиент
border = colors.success; textColor = '#FFFFFF';
textColor = '#1a7a3a'; boxShadow = cellShadows.found;
if (newFound) { if (newFound) {
animation = 'cellPopIn 0.4s ease, cellGlow 1s ease 0.4s'; animation = 'cellPopIn 0.4s ease, cellGlow 1s ease 0.4s';
} }
} else if (first) { } else if (first) {
bg = colors.cellFirst; bg = colors.cellFirst; // золотой градиент
border = colors.gold; textColor = '#FFFFFF';
textColor = '#b8860b';
animation = 'firstLetterPulse 1s ease infinite'; animation = 'firstLetterPulse 1s ease infinite';
boxShadow = '0 0 10px rgba(255, 215, 0, 0.5)'; boxShadow = cellShadows.first;
} else if (selected) { } else if (selected) {
bg = colors.cellSelected; bg = colors.cellSelected; // оранжевый градиент
border = colors.accent; textColor = '#FFFFFF';
textColor = colors.accent; boxShadow = cellShadows.selected;
boxShadow = `0 0 8px ${colors.accent}40`;
} }
return ( return (
+17 -12
View File
@@ -75,8 +75,11 @@ const WordSearchPage: React.FC = () => {
const confettiColors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#FF8A5C', '#2ECC71']; const confettiColors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#FF8A5C', '#2ECC71'];
const brandColor = '#2ECC71'; // 🔧 ОБНОВЛЕНО (30.09.2026): фиолетовые кнопки, зелёный — только для "найдено"
const palette = { play: brandColor }; const brandColor = '#2ECC71'; // зелёный (для очков, "найдено")
const buttonColor = '#7A3AFF'; // фиолетовый (для кнопок)
const buttonGradient = 'linear-gradient(135deg, #7A3AFF 0%, #A86BFF 100%)';
const palette = { play: buttonColor };
const textColor = '#1A1A2E'; const textColor = '#1A1A2E';
const subColor = '#6B7280'; const subColor = '#6B7280';
const bgColor = '#F4F5F7'; const bgColor = '#F4F5F7';
@@ -689,15 +692,16 @@ const WordSearchPage: React.FC = () => {
<div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}> <div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
<button onClick={() => navigate('/menu')} <button onClick={() => navigate('/menu')}
style={{ style={{
...glass({
padding: '10px 18px', padding: '10px 18px',
borderRadius: radius.md, borderRadius: radius.md,
}), border: 'none',
color: textColor, background: buttonGradient,
color: '#FFFFFF',
fontSize: '14px', fontSize: '14px',
fontWeight: 600, fontWeight: 700,
cursor: 'pointer', cursor: 'pointer',
transition: 'transform 0.2s ease', transition: 'transform 0.2s ease',
boxShadow: '0 4px 14px rgba(122, 58, 255, 0.4)',
}} }}
onTouchStart={(e) => { e.currentTarget.style.transform = 'scale(0.95)'; }} onTouchStart={(e) => { e.currentTarget.style.transform = 'scale(0.95)'; }}
onTouchEnd={(e) => { e.currentTarget.style.transform = 'scale(1)'; }} onTouchEnd={(e) => { e.currentTarget.style.transform = 'scale(1)'; }}
@@ -707,20 +711,21 @@ const WordSearchPage: React.FC = () => {
<button <button
onClick={() => setShowRules(true)} onClick={() => setShowRules(true)}
style={{ style={{
...glass({
width: '40px', width: '40px',
height: '40px', height: '40px',
borderRadius: radius.md, borderRadius: radius.md,
display: 'flex', border: 'none',
alignItems: 'center', background: buttonGradient,
justifyContent: 'center', color: '#FFFFFF',
}),
color: textColor,
fontSize: '18px', fontSize: '18px',
fontWeight: 700, fontWeight: 700,
cursor: 'pointer', cursor: 'pointer',
transition: 'transform 0.2s ease', transition: 'transform 0.2s ease',
flexShrink: 0, flexShrink: 0,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
boxShadow: '0 4px 14px rgba(122, 58, 255, 0.4)',
}} }}
onTouchStart={(e) => { e.currentTarget.style.transform = 'scale(0.95)'; }} onTouchStart={(e) => { e.currentTarget.style.transform = 'scale(0.95)'; }}
onTouchEnd={(e) => { e.currentTarget.style.transform = 'scale(1)'; }} onTouchEnd={(e) => { e.currentTarget.style.transform = 'scale(1)'; }}
+17 -4
View File
@@ -18,10 +18,23 @@ export const colors = {
danger: '#FF3B30', danger: '#FF3B30',
border: 'rgba(0,0,0,0.06)', border: 'rgba(0,0,0,0.06)',
borderStrong: 'rgba(0,0,0,0.12)', borderStrong: 'rgba(0,0,0,0.12)',
cellDefault: '#FFFFFF',
cellSelected: 'rgba(108,92,231,0.15)', // 🔧 ОБНОВЛЕНО (30.09.2026): плотные градиенты для клеток филвордов.
cellFound: 'rgba(52,199,89,0.2)', // Фон — градиент, буква — белая.
cellFirst: 'rgba(249,202,36,0.3)', cellDefault: 'linear-gradient(135deg, #7A3AFF 0%, #A86BFF 100%)',
cellSelected: 'linear-gradient(135deg, #F9471E 0%, #FF9A3D 100%)',
cellFound: 'linear-gradient(135deg, #1FD1A5 0%, #6BF0CB 100%)',
cellFirst: 'linear-gradient(135deg, #F9CA24 0%, #FFE066 100%)',
cellError: 'linear-gradient(135deg, #F35073 0%, #FF7A94 100%)',
};
// 🔧 НОВОЕ (30.09.2026): тени под градиенты клеток
export const cellShadows = {
default: '0 4px 12px rgba(122, 58, 255, 0.35)',
selected: '0 4px 14px rgba(249, 71, 30, 0.5)',
found: '0 4px 14px rgba(31, 209, 165, 0.5)',
first: '0 4px 14px rgba(249, 202, 36, 0.5)',
error: '0 4px 14px rgba(243, 80, 115, 0.5)',
}; };
export const fonts = { export const fonts = {