Skip to content

Commit f082455

Browse files
committed
refactor(site): redesign home page with library components and improve responsiveness
- Replace manual HTML elements with Typography, Card, Row/Col, Flex, Statistic components - Dynamically compute component stats and categories from router config - Fix feature icons to use solid primary background with white icons - Fix stats layout to show value above label using column-reverse - Use CSS grid for category cards matching original design - Override Typography heading specificity for custom sizing - Make sidebar a full-height drawer with elevated background - Keep nav links visible on small screens, hide secondary controls - Spread otherProps on Card for onClick support - Raise header z-index above sidebar drawer
1 parent d931f37 commit f082455

5 files changed

Lines changed: 157 additions & 115 deletions

File tree

components/card/card.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
2020
className,
2121
style,
2222
children,
23+
...otherProps
2324
} = props;
2425
const configContext = useContext(ConfigContext);
2526
const prefixCls = getPrefixCls('card', configContext.prefixCls, customisedCls);
@@ -81,7 +82,7 @@ const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
8182
};
8283

8384
return (
84-
<div ref={ref} className={cls} style={style}>
85+
<div ref={ref} {...otherProps} className={cls} style={style}>
8586
{renderHeader()}
8687
{renderChildren()}
8788
{renderFooter()}

site/src/components/header/header.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
width: 100%;
66
top: 0;
77
left: 0;
8-
z-index: 100;
8+
z-index: 101;
99
height: $header-height;
1010
background: var(--ty-color-bg-elevated);
1111
border-bottom: 1px solid var(--ty-color-border-secondary);
@@ -164,7 +164,15 @@
164164
}
165165

166166
@media (max-width: $size-xs) {
167-
&__nav {
167+
&__nav-item {
168+
margin-left: 12px;
169+
font-size: 14px;
170+
}
171+
172+
&__version,
173+
&__locale-toggle,
174+
&__color-swatch,
175+
&__theme-toggle {
168176
display: none;
169177
}
170178
}

site/src/components/sidebar-menu/sidebar-menu.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
.sidebar-menu {
44
width: 250px;
5-
height: calc(100% - #{$header-height});
65
position: fixed;
6+
top: $header-height;
7+
bottom: 0;
8+
left: 0;
79
overflow-y: auto;
10+
background: var(--ty-color-bg-elevated);
811
border-right: 1px solid var(--ty-color-border);
912
padding: 20px 0;
1013
z-index: 99;
@@ -98,9 +101,7 @@
98101
@media (max-width: $size-md) {
99102
transform: translateX(-100%);
100103
transition: transform 0.3s ease;
101-
background: var(--ty-color-bg-elevated);
102104
z-index: 101;
103-
top: $header-height;
104105

105106
&_open {
106107
transform: translateX(0);

site/src/containers/home/home.scss

Lines changed: 85 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@
2626
background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--ty-color-primary) 8%, transparent) 0%, transparent 70%);
2727
}
2828

29-
&__logo-container {
30-
position: relative;
31-
margin-right: 40px;
32-
}
33-
3429
&__react-login-container {
3530
position: absolute;
3631
left: 50%;
@@ -49,22 +44,25 @@
4944
width: 200px;
5045
}
5146

52-
&__title {
47+
&__title.ty-typography {
5348
font-weight: 600;
5449
font-size: 45px;
5550
margin: 30px 0 0;
5651
}
5752

58-
&__subtitle {
53+
&__subtitle.ty-typography {
5954
font-weight: 400;
60-
margin: 10px 0 0 0;
6155
font-size: 24px;
6256
color: var(--ty-color-text-secondary);
6357
}
6458

59+
// Override Typography's adjacent sibling margin rules
60+
&__slider .ty-typography + .ty-typography {
61+
margin: 10px 0 0 0;
62+
}
63+
6564
&__btn-group {
6665
margin: 30px 0 0 0;
67-
display: flex;
6866
}
6967

7068
&__btn {
@@ -77,47 +75,79 @@
7775
padding: 70px 0;
7876
}
7977

80-
&__feature-title {
78+
&__feature-title.ty-typography {
8179
text-align: center;
8280
font-weight: 500;
83-
margin: 0px 0 40px;
81+
margin: 0 0 40px;
8482
}
8583

8684
&__features {
87-
display: flex;
8885
padding: 0 40px;
89-
flex-wrap: wrap;
9086
}
9187

92-
// Stats ribbon
93-
&__stats {
88+
&__feature-card {
89+
text-align: center;
90+
height: 100%;
91+
background: transparent;
92+
animation: fadeInUp 0.5s ease both;
93+
transition: transform 0.2s;
94+
95+
&:hover {
96+
transform: translateY(-4px);
97+
}
98+
99+
h3.ty-typography {
100+
margin: 0;
101+
font-weight: 600;
102+
font-size: 1.25rem;
103+
}
104+
105+
p.ty-typography {
106+
margin: 0;
107+
color: var(--ty-color-text-secondary);
108+
font-size: 15px;
109+
line-height: 1.5;
110+
}
111+
}
112+
113+
&__feature-icon {
94114
display: flex;
115+
align-items: center;
95116
justify-content: center;
96-
gap: 60px;
117+
width: 48px;
118+
height: 48px;
119+
border-radius: 50%;
120+
background: var(--ty-color-primary);
121+
color: #fff;
122+
}
123+
124+
// Stats ribbon
125+
&__stats {
97126
padding: 50px 40px;
98127
background: color-mix(in srgb, var(--ty-color-primary) 4%, transparent);
99128
border-top: 1px solid var(--ty-color-border-secondary);
100-
}
101129

102-
&__stat {
103-
display: flex;
104-
flex-direction: column;
105-
align-items: center;
106-
animation: fadeInUp 0.5s ease both;
107-
}
130+
.ty-statistic {
131+
display: flex;
132+
flex-direction: column-reverse;
133+
align-items: center;
134+
animation: fadeInUp 0.5s ease both;
135+
}
108136

109-
&__stat-value {
110-
font-size: 36px;
111-
font-weight: 700;
112-
color: var(--ty-color-primary);
113-
}
137+
.ty-statistic__content {
138+
color: var(--ty-color-primary);
139+
font-size: 36px;
140+
font-weight: 700;
141+
}
114142

115-
&__stat-label {
116-
margin-top: 6px;
117-
font-size: 14px;
118-
color: var(--ty-color-text-secondary);
119-
text-transform: uppercase;
120-
letter-spacing: 1px;
143+
.ty-statistic__title {
144+
margin-bottom: 0;
145+
margin-top: 6px;
146+
font-size: 14px;
147+
color: var(--ty-color-text-secondary);
148+
text-transform: uppercase;
149+
letter-spacing: 1px;
150+
}
121151
}
122152

123153
// Categories grid
@@ -128,20 +158,24 @@
128158
padding: 0 60px;
129159
max-width: 1000px;
130160
margin: 0 auto;
161+
162+
.ty-card + .ty-card {
163+
margin-top: 0;
164+
}
131165
}
132166

133167
&__category {
134-
display: flex;
135-
flex-direction: column;
136-
align-items: center;
137-
padding: 32px 16px;
138-
border-radius: 12px;
139-
border: 1px solid var(--ty-color-border-secondary);
140-
background: var(--ty-color-bg-elevated);
141168
color: var(--ty-color-primary);
142169
cursor: pointer;
143-
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
144170
animation: fadeInUp 0.5s ease both;
171+
transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
172+
padding: 32px 16px;
173+
border-radius: 12px;
174+
175+
.ty-typography strong {
176+
font-size: 16px;
177+
color: var(--ty-color-text);
178+
}
145179

146180
&:hover {
147181
transform: translateY(-4px);
@@ -150,13 +184,6 @@
150184
}
151185
}
152186

153-
&__category-name {
154-
margin: 14px 0 4px;
155-
font-size: 16px;
156-
font-weight: 600;
157-
color: var(--ty-color-text);
158-
}
159-
160187
&__category-count {
161188
font-size: 13px;
162189
color: var(--ty-color-text-tertiary);
@@ -173,7 +200,6 @@
173200
}
174201

175202
&__stats {
176-
gap: 40px;
177203
padding: 40px 20px;
178204
}
179205

@@ -187,12 +213,14 @@
187213
padding: 50px 0;
188214
}
189215

190-
&__title {
216+
&__title.ty-typography {
191217
font-size: 32px;
192218
}
193219

194-
&__subtitle {
220+
&__subtitle.ty-typography {
195221
font-size: 18px;
222+
padding: 0 20px;
223+
text-align: center;
196224
}
197225

198226
&__react-logo {
@@ -205,31 +233,26 @@
205233
}
206234

207235
&__stats {
208-
flex-wrap: wrap;
209236
gap: 24px 40px;
210-
}
211237

212-
&__stat-value {
213-
font-size: 28px;
238+
.ty-statistic__content {
239+
font-size: 28px;
240+
}
214241
}
215242

216243
&__categories {
217244
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
218245
gap: 16px;
219246
padding: 0 20px;
220247
}
221-
222-
&__category {
223-
padding: 24px 12px;
224-
}
225248
}
226249

227250
@media (max-width: $size-xs) {
228-
&__title {
251+
&__title.ty-typography {
229252
font-size: 26px;
230253
}
231254

232-
&__subtitle {
255+
&__subtitle.ty-typography {
233256
font-size: 16px;
234257
}
235258

0 commit comments

Comments
 (0)