Skip to content

Commit c368d94

Browse files
refactor: consolidate population and complexity sections into ChartSection
Add named slot 'extra' to ChartSection for between-header-and-card content. Replace hand-rolled population-section and complexity-section (which duplicated ChartSection's structure, h2 styling, and card CSS) with ChartSection components. Move complexity-metrics CSS into the only place that uses it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7af8cda commit c368d94

File tree

2 files changed

+37
-140
lines changed

2 files changed

+37
-140
lines changed

src/components/ChartSection.astro

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@ const { id, title, subtitle } = Astro.props;
88
---
99

1010
<section id={id} class="chart-section">
11-
<div class="chart-header" style="max-width:65ch;margin:0 auto 1.5rem;">
12-
<h2
13-
style="
14-
font-family:'Raleway','Arial Black',sans-serif;
15-
font-size:clamp(1.5rem,4vw,2.2rem);
16-
font-weight:800;
17-
letter-spacing:-0.02em;
18-
color:#F2F0E5;
19-
margin-bottom:0.35rem;
20-
"
21-
>
22-
{title}
23-
</h2>
24-
{subtitle && <p style="color:#64748b;max-width:65ch;margin:0 auto;">{subtitle}</p>}
11+
<div class="chart-header">
12+
<h2>{title}</h2>
13+
{subtitle && <p class="chart-subtitle">{subtitle}</p>}
2514
</div>
2615

16+
<slot name="extra" />
17+
2718
<div class="chart-card">
2819
<slot />
2920
</div>
@@ -35,6 +26,23 @@ const { id, title, subtitle } = Astro.props;
3526
max-width: 1400px;
3627
margin: 0 auto;
3728
}
29+
.chart-header {
30+
max-width: 65ch;
31+
margin: 0 auto 1.5rem;
32+
}
33+
.chart-header h2 {
34+
font-family: 'Raleway', 'Arial Black', sans-serif;
35+
font-size: clamp(1.5rem, 4vw, 2.2rem);
36+
font-weight: 800;
37+
letter-spacing: -0.02em;
38+
color: #F2F0E5;
39+
margin-bottom: 0.35rem;
40+
}
41+
.chart-subtitle {
42+
color: #94a3b8;
43+
line-height: 1.7;
44+
font-size: 1rem;
45+
}
3846
.chart-card {
3947
background: #252525;
4048
border: 1px solid #3a3a3a;

src/pages/index.astro

Lines changed: 15 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,20 @@ import ComplexityChart from '../components/ComplexityChart';
6262
<SkillFilters client:only="react" />
6363
</ChartSection>
6464

65-
<section id="population" class="population-section">
66-
<div class="population-header">
67-
<h2>Developer Population</h2>
68-
<p class="population-story">
69-
In 1970 fewer than 100,000 people worldwide wrote code — mostly academics and defense
70-
contractors working on mainframes. The personal computer changed that: by the mid-1980s
71-
anyone with a desk could program. Then the web exploded the numbers again — the dot-com
72-
boom pulled millions into the field between 1995 and 2000, and even the bust that followed
73-
barely dented the trajectory. Smartphones, cloud computing, and the startup gold rush of the
74-
2010s kept the curve steep, while coding bootcamps and free online courses lowered the
75-
barrier to entry almost to zero. The result: the developer population roughly doubles every
76-
eight years. That growth rate is exactly why senior developers are so scarce — when half of
77-
all developers have less than eight years of experience at any given moment, seniority is
78-
a mathematical minority, not a failure of hiring.
79-
</p>
80-
</div>
81-
82-
<div class="population-chart-card">
83-
<PopulationChart client:only="react" />
84-
</div>
85-
</section>
86-
87-
<section id="complexity" class="complexity-section">
88-
<div class="complexity-header">
89-
<h2>Software Complexity Growth</h2>
90-
<p class="complexity-story">
91-
In the 1970s a whole program fit on a stack of punch cards. C and Unix made code portable,
92-
PCs multiplied the audience, but the tools stayed simple. The web broke that — software
93-
suddenly had to run on unknown browsers, talk to remote servers, and handle millions of users.
94-
Open source turned shared dependencies into an avalanche nobody fully controls. The security
95-
surface grew in lockstep, the stack fragmented into containers, orchestrators, cloud services,
96-
and dozens more tools. All of it compounds: more packages mean more vulnerabilities, more
97-
technologies mean more integration surface, more decision points mean more places to break.
98-
</p>
99-
</div>
65+
<ChartSection
66+
id="population"
67+
title="Developer Population"
68+
subtitle="In 1970 fewer than 100,000 people worldwide wrote code — mostly academics and defense contractors working on mainframes. The personal computer changed that: by the mid-1980s anyone with a desk could program. Then the web exploded the numbers again — the dot-com boom pulled millions into the field between 1995 and 2000, and even the bust that followed barely dented the trajectory. Smartphones, cloud computing, and the startup gold rush of the 2010s kept the curve steep, while coding bootcamps and free online courses lowered the barrier to entry almost to zero. The result: the developer population roughly doubles every eight years. That growth rate is exactly why senior developers are so scarce — when half of all developers have less than eight years of experience at any given moment, seniority is a mathematical minority, not a failure of hiring."
69+
>
70+
<PopulationChart client:only="react" />
71+
</ChartSection>
10072

101-
<div class="complexity-metrics">
73+
<ChartSection
74+
id="complexity"
75+
title="Software Complexity Growth"
76+
subtitle="In the 1970s a whole program fit on a stack of punch cards. C and Unix made code portable, PCs multiplied the audience, but the tools stayed simple. The web broke that — software suddenly had to run on unknown browsers, talk to remote servers, and handle millions of users. Open source turned shared dependencies into an avalanche nobody fully controls. The security surface grew in lockstep, the stack fragmented into containers, orchestrators, cloud services, and dozens more tools. All of it compounds: more packages mean more vulnerabilities, more technologies mean more integration surface, more decision points mean more places to break."
77+
>
78+
<div slot="extra" class="complexity-metrics">
10279
<details class="complexity-metric">
10380
<summary><span class="metric-dot" style="background:#60a5fa;"></span>Linux LOC</summary>
10481
<p>
@@ -152,78 +129,10 @@ import ComplexityChart from '../components/ComplexityChart';
152129
</details>
153130
</div>
154131

155-
<div class="complexity-chart-card">
156-
<ComplexityChart client:only="react" />
157-
</div>
158-
</section>
132+
<ComplexityChart client:only="react" />
133+
</ChartSection>
159134

160135
<style>
161-
.population-section {
162-
padding: 3.5rem 2rem;
163-
max-width: 1400px;
164-
margin: 0 auto;
165-
}
166-
.population-header {
167-
max-width: 65ch;
168-
margin: 0 auto 1.5rem;
169-
}
170-
.population-header h2 {
171-
font-family: 'Raleway', 'Arial Black', sans-serif;
172-
font-size: clamp(1.5rem, 4vw, 2.2rem);
173-
font-weight: 800;
174-
letter-spacing: -0.02em;
175-
color: #F2F0E5;
176-
margin-bottom: 0.35rem;
177-
}
178-
.population-story {
179-
color: #94a3b8;
180-
line-height: 1.7;
181-
font-size: 1rem;
182-
}
183-
.population-chart-card {
184-
background: #252525;
185-
border: 1px solid #3a3a3a;
186-
border-radius: 1rem;
187-
padding: 1.5rem 1.5rem 1rem;
188-
position: relative;
189-
}
190-
@media (max-width: 768px) {
191-
.population-section {
192-
padding: 2rem 0;
193-
}
194-
.population-header {
195-
padding: 0 2rem;
196-
}
197-
.population-chart-card {
198-
padding: 1.5rem;
199-
border-radius: 0;
200-
border-left: none;
201-
border-right: none;
202-
overflow: hidden;
203-
}
204-
}
205-
.complexity-section {
206-
padding: 3.5rem 2rem;
207-
max-width: 1400px;
208-
margin: 0 auto;
209-
}
210-
.complexity-header {
211-
max-width: 65ch;
212-
margin: 0 auto 1.5rem;
213-
}
214-
.complexity-header h2 {
215-
font-family: 'Raleway', 'Arial Black', sans-serif;
216-
font-size: clamp(1.5rem, 4vw, 2.2rem);
217-
font-weight: 800;
218-
letter-spacing: -0.02em;
219-
color: #F2F0E5;
220-
margin-bottom: 0.35rem;
221-
}
222-
.complexity-story {
223-
color: #94a3b8;
224-
line-height: 1.7;
225-
font-size: 1rem;
226-
}
227136
.complexity-metrics {
228137
display: grid;
229138
gap: 0.25rem;
@@ -282,30 +191,10 @@ import ComplexityChart from '../components/ComplexityChart';
282191
font-family: 'JetBrains Mono', 'Fira Code', monospace;
283192
font-size: 0.88em;
284193
}
285-
.complexity-chart-card {
286-
background: #252525;
287-
border: 1px solid #3a3a3a;
288-
border-radius: 1rem;
289-
padding: 1.5rem 1.5rem 1rem;
290-
position: relative;
291-
}
292194
@media (max-width: 768px) {
293-
.complexity-section {
294-
padding: 2rem 0;
295-
}
296-
.complexity-header {
297-
padding: 0 2rem;
298-
}
299195
.complexity-metrics {
300196
padding: 0 2rem;
301197
}
302-
.complexity-chart-card {
303-
padding: 1.5rem;
304-
border-radius: 0;
305-
border-left: none;
306-
border-right: none;
307-
overflow: hidden;
308-
}
309198
}
310199
</style>
311200

0 commit comments

Comments
 (0)