Spaces:
Running
Running
Update src/components/logo-animation/LogoAnimation.tsx
Browse files
src/components/logo-animation/LogoAnimation.tsx
CHANGED
@@ -2,33 +2,76 @@
|
|
2 |
import React from 'react';
|
3 |
import cn from 'classnames';
|
4 |
|
5 |
-
//
|
6 |
-
const SvgHumanIcon = () =>
|
7 |
-
<svg width="100%" height="100%" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
|
8 |
-
{/* *** MODIFIED: تغییر stroke به رنگ سفید مستقیم اگر currentColor کار نمیکند *** */}
|
9 |
-
{/* اگر آدمک شما باید همیشه سفید باشد، از stroke="#FFFFFF" استفاده کنید. */}
|
10 |
-
{/* اگر رنگ آدمک باید با تم تیره/روشن تغییر کند، باید currentColor با دقت بیشتری مدیریت شود. */}
|
11 |
-
{/* فعلاً فرض میکنیم آدمک همیشه باید روی حلقههای آبی، سفید باشد. */}
|
12 |
-
<path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="#FFFFFF" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
|
13 |
-
<path d="M44.0371 50.1862C33.8519 50.1862 25.5186 41.8612 25.5186 31.6863V26.1363C25.5186 15.9613 33.8519 7.63635 44.0371 7.63635C54.2223 7.63635 62.5556 15.9613 62.5556 26.1363V31.6863C62.5556 41.8612 54.2223 50.1862 44.0371 50.1862Z" stroke="#FFFFFF" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
|
14 |
-
</svg>
|
15 |
-
);
|
16 |
-
|
17 |
-
// ... (بقیه کامپوننت LogoAnimation.tsx بدون تغییر) ...
|
18 |
const logoColorConfig = { /* ... */ };
|
19 |
-
interface LogoAnimationProps { /* ... */ }
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
// ... (JSX مثل قبل) ...
|
26 |
return (
|
27 |
-
<div
|
28 |
-
|
29 |
-
{
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
</div>
|
32 |
);
|
33 |
};
|
|
|
34 |
export default LogoAnimation;
|
|
|
2 |
import React from 'react';
|
3 |
import cn from 'classnames';
|
4 |
|
5 |
+
// ... (SvgHumanIcon و logoColorConfig مثل قبل) ...
|
6 |
+
const SvgHumanIcon = () => {/* ... */};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
const logoColorConfig = { /* ... */ };
|
|
|
8 |
|
9 |
+
// **** این بخش بسیار مهم است ****
|
10 |
+
interface LogoAnimationProps {
|
11 |
+
isMini: boolean;
|
12 |
+
isActive: boolean;
|
13 |
+
type?: 'human' | 'ai'; // type اختیاری است و پیشفرض 'human' دارد
|
14 |
+
forFooter?: boolean; // forFooter اختیاری است و پیشفرض false دارد
|
15 |
+
}
|
16 |
+
// **** پایان بخش مهم ****
|
17 |
+
|
18 |
+
const LogoAnimation: React.FC<LogoAnimationProps> = ({
|
19 |
+
isMini,
|
20 |
+
isActive,
|
21 |
+
type = 'human', // مقدار پیشفرض برای type
|
22 |
+
forFooter = false, // مقدار پیشفرض برای forFooter
|
23 |
+
}) => {
|
24 |
+
if (!isActive) return null;
|
25 |
+
|
26 |
+
// ... (بقیه منطق کامپوننت LogoAnimation مثل قبل) ...
|
27 |
+
const colorKey = type === 'human' ? 'blue' : (type === 'ai' ? 'green' : 'gray');
|
28 |
+
const currentColors = logoColorConfig[colorKey as keyof typeof logoColorConfig] || logoColorConfig.gray;
|
29 |
+
const size = isMini ? 80 : 200;
|
30 |
+
const iconDisplaySize = isMini ? 35 : 70;
|
31 |
+
const iconInset = (size - iconDisplaySize) / 2;
|
32 |
+
const insets = {
|
33 |
+
ping: isMini ? "10px" : "40px",
|
34 |
+
ring1: isMini ? "0px" : "0px",
|
35 |
+
ring2: isMini ? "5px" : "20px",
|
36 |
+
ring3: isMini ? "12px" : "50px",
|
37 |
+
iconContainer: `${iconInset}px`
|
38 |
+
};
|
39 |
+
const IconComponent = type === 'human' ? SvgHumanIcon : null;
|
40 |
|
|
|
41 |
return (
|
42 |
+
<div
|
43 |
+
className={cn("logo-animation-wrapper", { "for-footer": forFooter })}
|
44 |
+
style={{ width: `${size}px`, height: `${size}px` }}
|
45 |
+
>
|
46 |
+
<div className="hidden bg-blue-200 bg-blue-300 bg-blue-400 bg-green-200 bg-green-300 bg-green-400 bg-gray-200 bg-gray-300 bg-gray-400 dark:bg-blue-700 dark:bg-blue-600 dark:bg-blue-500 dark:bg-green-700 dark:bg-green-600 dark:bg-green-500 dark:bg-gray-700 dark:bg-gray-600 dark:bg-gray-500"></div>
|
47 |
+
<div
|
48 |
+
className={`absolute rounded-full opacity-50 animate-ping ${currentColors.ping}`}
|
49 |
+
style={{ inset: insets.ping }}
|
50 |
+
></div>
|
51 |
+
<div
|
52 |
+
className={`absolute rounded-full opacity-50 ${currentColors.ring1}`}
|
53 |
+
style={{ inset: insets.ring1 }}
|
54 |
+
></div>
|
55 |
+
<div
|
56 |
+
className={`absolute rounded-full opacity-50 ${currentColors.ring2}`}
|
57 |
+
style={{ inset: insets.ring2 }}
|
58 |
+
></div>
|
59 |
+
<div
|
60 |
+
className={`absolute rounded-full opacity-50 ${currentColors.ring3}`}
|
61 |
+
style={{ inset: insets.ring3 }}
|
62 |
+
></div>
|
63 |
+
<div
|
64 |
+
className="z-10 absolute flex items-center justify-center"
|
65 |
+
style={{
|
66 |
+
inset: insets.iconContainer,
|
67 |
+
width: `${iconDisplaySize}px`,
|
68 |
+
height: `${iconDisplaySize}px`,
|
69 |
+
}}
|
70 |
+
>
|
71 |
+
{IconComponent && <IconComponent />}
|
72 |
+
</div>
|
73 |
</div>
|
74 |
);
|
75 |
};
|
76 |
+
|
77 |
export default LogoAnimation;
|