Skip to content

Commit 04edc8d

Browse files
committed
refactor(installation): 重构Installation组件及InstallationStep子组件,内联样式并优化组件结构
1 parent 8f5e538 commit 04edc8d

File tree

2 files changed

+91
-16
lines changed

2 files changed

+91
-16
lines changed

office-website/src/components/Installation/InstallationStep.tsx

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
import React from 'react';
2-
import {
3-
StepItem,
4-
StepNumber,
5-
StepTitle,
6-
StepDescription,
7-
CodeBlock
8-
} from '../../styles/components/Installation.styles';
2+
import styled from 'styled-components';
93
import CustomCodeBlock from '../CustomCodeBlock';
104

5+
const StepItem = styled.div`
6+
position: relative;
7+
padding-left: 3.5rem;
8+
`;
9+
10+
const StepNumber = styled.div`
11+
position: absolute;
12+
left: 0;
13+
top: 0;
14+
width: 2.5rem;
15+
height: 2.5rem;
16+
border-radius: 50%;
17+
background-color: ${({ theme }) => theme.colors.primary};
18+
color: white;
19+
display: flex;
20+
align-items: center;
21+
justify-content: center;
22+
font-weight: 700;
23+
font-size: 1.25rem;
24+
`;
25+
26+
const StepTitle = styled.h3`
27+
font-size: 1.25rem;
28+
font-weight: 700;
29+
margin-bottom: 0.75rem;
30+
`;
31+
32+
const StepDescription = styled.p`
33+
color: ${({ theme }) => theme.colors.darkGray};
34+
margin-bottom: 1.25rem;
35+
`;
36+
37+
const CodeBlock = styled.div`
38+
background-color: ${({ theme }) => theme.colors.background};
39+
border-radius: ${({ theme }) => theme.borderRadius.medium};
40+
overflow: hidden;
41+
box-shadow: ${({ theme }) => theme.boxShadow.medium};
42+
`;
43+
1144
interface InstallationStepProps {
1245
number: number;
1346
title: string;

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

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,58 @@
11
import React from 'react';
2-
import {
3-
SectionContainer,
4-
SectionInner,
5-
SectionHeading,
6-
Title,
7-
Subtitle,
8-
InstallationContent,
9-
StepsList
10-
} from '../../styles/components/Installation.styles';
2+
import styled from 'styled-components';
113
import InstallationStep from './InstallationStep';
124
import { leftColumnSteps, rightColumnSteps } from './stepsData';
135

6+
const SectionContainer = styled.section`
7+
padding: 6rem 0;
8+
background-color: ${({ theme }) => theme.colors.backgroundAlt};
9+
`;
10+
11+
const SectionInner = styled.div`
12+
max-width: 1200px;
13+
margin: 0 auto;
14+
padding: 0 1.5rem;
15+
`;
16+
17+
const SectionHeading = styled.div`
18+
text-align: center;
19+
margin-bottom: 4rem;
20+
`;
21+
22+
const Title = styled.h2`
23+
font-size: 2.5rem;
24+
font-weight: 800;
25+
margin-bottom: 1rem;
26+
27+
@media (max-width: ${({ theme }) => theme.breakpoints.md}) {
28+
font-size: 2rem;
29+
}
30+
`;
31+
32+
const Subtitle = styled.p`
33+
font-size: 1.125rem;
34+
max-width: 700px;
35+
margin: 0 auto 2rem;
36+
color: ${({ theme }) => theme.colors.darkGray};
37+
`;
38+
39+
const InstallationContent = styled.div`
40+
display: grid;
41+
grid-template-columns: 1fr 1fr;
42+
gap: 3rem;
43+
align-items: start;
44+
45+
@media (max-width: ${({ theme }) => theme.breakpoints.lg}) {
46+
grid-template-columns: 1fr;
47+
}
48+
`;
49+
50+
const StepsList = styled.div`
51+
display: flex;
52+
flex-direction: column;
53+
gap: 2rem;
54+
`;
55+
1456
const Installation: React.FC = () => {
1557
return (
1658
<SectionContainer id="installation">

0 commit comments

Comments
 (0)