Skip to content

Commit 8f5e538

Browse files
committed
refactor(community): 重构Community组件及QrCodeCard子组件,优化代码结构与样式管理
1 parent afbbc9b commit 8f5e538

File tree

2 files changed

+77
-12
lines changed

2 files changed

+77
-12
lines changed

office-website/src/components/Community/QrCodeCard.tsx

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
11
import React from 'react';
2-
import {
3-
QrCodeItem,
4-
QrCodeImage,
5-
QrCodeText,
6-
StyledLink
7-
} from '../../styles/components/Community.styles';
2+
import styled from 'styled-components';
3+
4+
const QrCodeItem = styled.div`
5+
display: flex;
6+
flex-direction: column;
7+
align-items: center;
8+
max-width: 240px;
9+
background-color: white;
10+
border-radius: 12px;
11+
padding: 1.5rem;
12+
box-shadow: ${({ theme }) => theme.boxShadow.medium};
13+
transition: transform 0.3s ease, box-shadow 0.3s ease;
14+
15+
&:hover {
16+
transform: translateY(-5px);
17+
box-shadow: ${({ theme }) => theme.boxShadow.large};
18+
}
19+
`;
20+
21+
const QrCodeImage = styled.img`
22+
width: 200px;
23+
height: auto;
24+
border-radius: 8px;
25+
margin-bottom: 1.5rem;
26+
`;
27+
28+
const QrCodeText = styled.p`
29+
color: ${({ theme }) => theme.colors.text};
30+
text-align: center;
31+
font-size: 1rem;
32+
line-height: 1.6;
33+
`;
34+
35+
const StyledLink = styled.a`
36+
color: ${({ theme }) => theme.colors.primary};
37+
font-weight: 500;
38+
text-decoration: none;
39+
transition: color 0.2s ease;
40+
41+
&:hover {
42+
color: ${({ theme }) => theme.colors.primaryDark};
43+
text-decoration: underline;
44+
}
45+
`;
846

947
interface QrCodeCardProps {
1048
imageUrl: string;

office-website/src/components/Community/index.tsx

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
11
import React from 'react';
2-
import {
3-
CommunityContainer,
4-
CommunityContent,
5-
CommunityTitle,
6-
QrCodesContainer
7-
} from '../../styles/components/Community.styles';
2+
import styled from 'styled-components';
83
import QrCodeCard from './QrCodeCard';
94
import { qrCodes } from './QrCodeData';
105

6+
const CommunityContainer = styled.section`
7+
padding: 5rem 0;
8+
background-color: ${({ theme }) => theme.colors.backgroundAlt};
9+
`;
10+
11+
const CommunityContent = styled.div`
12+
max-width: 1200px;
13+
margin: 0 auto;
14+
padding: 0 1.5rem;
15+
`;
16+
17+
const CommunityTitle = styled.h2`
18+
color: ${({ theme }) => theme.colors.heading};
19+
font-size: 2.25rem;
20+
font-weight: 700;
21+
text-align: center;
22+
margin-bottom: 2.5rem;
23+
`;
24+
25+
const QrCodesContainer = styled.div`
26+
display: flex;
27+
justify-content: center;
28+
flex-wrap: wrap;
29+
gap: 3rem;
30+
margin: 3rem 0;
31+
32+
@media (max-width: ${({ theme }) => theme.breakpoints.md}) {
33+
flex-direction: column;
34+
align-items: center;
35+
}
36+
`;
37+
1138
const Community: React.FC = () => {
1239
return (
1340
<CommunityContainer id="community">

0 commit comments

Comments
 (0)