|
1 | 1 | import React, { useState } from 'react'; |
2 | 2 |
|
3 | | -export default function PartnerCard({ name, product, description, link }) { |
4 | | - const [expanded, setExpanded] = useState(false); |
| 3 | +export default function PartnerCard({ name, logo, product, description, link }) { |
| 4 | + const [hovered, setHovered] = useState(false); |
5 | 5 |
|
6 | 6 | return ( |
7 | 7 | <div |
| 8 | + onMouseEnter={() => setHovered(true)} |
| 9 | + onMouseLeave={() => setHovered(false)} |
| 10 | + onClick={() => window.open(link, '_blank')} |
8 | 11 | style={{ |
9 | | - border: '1px solid #e0e0e0', |
10 | | - borderRadius: '12px', |
11 | | - padding: '20px', |
| 12 | + position: 'relative', |
| 13 | + borderRadius: '20px', |
| 14 | + padding: '24px', |
12 | 15 | margin: '10px', |
13 | 16 | width: '100%', |
14 | | - maxWidth: '400px', |
15 | | - boxShadow: '0 2px 8px rgba(0, 0, 0, 0.05)', |
| 17 | + maxWidth: '380px', |
| 18 | + height: hovered ? '360px' : '260px', // 加高 |
| 19 | + background: 'rgba(255, 255, 255, 0.7)', |
| 20 | + backdropFilter: 'blur(12px)', |
| 21 | + WebkitBackdropFilter: 'blur(12px)', |
| 22 | + boxShadow: hovered |
| 23 | + ? '0 16px 32px rgba(0, 0, 0, 0.15)' |
| 24 | + : '0 6px 12px rgba(0, 0, 0, 0.08)', |
16 | 25 | display: 'flex', |
17 | 26 | flexDirection: 'column', |
18 | | - backgroundColor: '#fff', |
| 27 | + alignItems: 'center', //子元素居中 |
| 28 | + justifyContent: 'flex-start', |
| 29 | + cursor: 'pointer', |
| 30 | + overflow: 'hidden', |
| 31 | + transition: 'all 0.4s cubic-bezier(0.22, 1, 0.36, 1)', |
| 32 | + transform: hovered ? 'scale(1.05)' : 'scale(1)', |
19 | 33 | }} |
20 | 34 | > |
21 | | - <div> |
22 | | - <h3 style={{ margin: '0 0 10px 0' }}>{name}</h3> |
23 | | - <h4 style={{ margin: '0 0 10px 0', color: '#555' }}>{product}</h4> |
24 | | - <p |
| 35 | + {/* Name */} |
| 36 | + <h3 style={{ |
| 37 | + margin: '10px 0 5px 0', |
| 38 | + fontSize: '32px', |
| 39 | + fontWeight: '700', |
| 40 | + color: '#0084FF', |
| 41 | + textAlign: 'center', |
| 42 | + }}> |
| 43 | + {name} |
| 44 | + </h3> |
| 45 | + |
| 46 | + {/* Logo图片 */} |
| 47 | + {logo && ( |
| 48 | + <img |
| 49 | + src={logo} |
| 50 | + alt={`${name} logo`} |
25 | 51 | style={{ |
26 | | - fontSize: '14px', |
27 | | - color: '#666', |
28 | | - lineHeight: '1.6', |
29 | | - overflow: expanded ? 'visible' : 'hidden', |
30 | | - display: '-webkit-box', |
31 | | - WebkitLineClamp: expanded ? 'none' : 3, |
32 | | - WebkitBoxOrient: 'vertical', |
| 52 | + width: '150px', |
| 53 | + height: '75px', |
| 54 | + objectFit: 'contain', |
| 55 | + margin: '5px 0', // 上下留空 |
33 | 56 | }} |
34 | | - > |
35 | | - {description} |
36 | | - </p> |
37 | | - {description.length > 120 && ( |
38 | | - <button |
39 | | - onClick={() => setExpanded(!expanded)} |
40 | | - style={{ |
41 | | - marginTop: '4px', |
42 | | - background: 'none', |
43 | | - border: 'none', |
44 | | - color: '#0078e7', |
45 | | - cursor: 'pointer', |
46 | | - fontSize: '14px', |
47 | | - padding: 0, |
48 | | - }} |
49 | | - > |
50 | | - {expanded ? 'Collapse' : 'Expand'} |
51 | | - </button> |
52 | | - )} |
53 | | - </div> |
| 57 | + /> |
| 58 | + )} |
| 59 | + |
| 60 | + {/* Product */} |
| 61 | + <h4 style={{ |
| 62 | + margin: '10px 0 0 0', |
| 63 | + fontSize: '16px', |
| 64 | + fontWeight: '400', |
| 65 | + color: '#000000', |
| 66 | + textAlign: 'center', |
| 67 | + }}> |
| 68 | + {product} |
| 69 | + </h4> |
54 | 70 |
|
55 | | - <div style={{ marginTop: '8px' }}> |
56 | | - <a |
57 | | - href={link} |
58 | | - target="_blank" |
59 | | - rel="noopener noreferrer" |
| 71 | + {/* 蒙版 */} |
| 72 | + {hovered && ( |
| 73 | + <div |
60 | 74 | style={{ |
61 | | - padding: '8px 16px', |
62 | | - backgroundColor: '#0078e7', |
| 75 | + position: 'absolute', |
| 76 | + top: 0, |
| 77 | + left: 0, |
| 78 | + right: 0, |
| 79 | + bottom: 0, |
| 80 | + background: 'rgba(0, 0, 0, 0.7)', |
63 | 81 | color: '#fff', |
64 | | - textDecoration: 'none', |
65 | | - borderRadius: '6px', |
| 82 | + display: 'flex', |
| 83 | + alignItems: 'center', |
| 84 | + justifyContent: 'center', |
| 85 | + padding: '20px', |
| 86 | + textAlign: 'center', |
66 | 87 | fontSize: '14px', |
| 88 | + lineHeight: '1.8', |
| 89 | + overflowY: 'auto', |
| 90 | + borderRadius: '20px', |
67 | 91 | }} |
68 | 92 | > |
69 | | - Visit Website |
70 | | - </a> |
71 | | - </div> |
| 93 | + {description} |
| 94 | + </div> |
| 95 | + )} |
72 | 96 | </div> |
73 | 97 | ); |
74 | 98 | } |
0 commit comments