Skip to content

Commit 7d39b6e

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent ad7f72d commit 7d39b6e

9 files changed

Lines changed: 2203 additions & 28 deletions

File tree

public/wiring.svg

Lines changed: 2017 additions & 0 deletions
Loading

src/components/Architecture.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const components = [
1818

1919
<section class="section architecture-section">
2020
<div class="container">
21-
<h2 class="section-title">Data Model</h2>
22-
<p class="section-subtitle">
21+
<h2 class="section-title scroll-reveal">Data Model</h2>
22+
<p class="section-subtitle scroll-reveal">
2323
A standardized format for describing RF/microwave wiring inside dilution
2424
refrigerators.
2525
</p>
26-
<div class="architecture-grid">
26+
<div class="architecture-grid scroll-stagger">
2727
<div class="arch-card">
2828
<h3 class="arch-card-title">Temperature Stages</h3>
2929
<div class="stages-list">

src/components/CoreUsage.astro

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ validate_wiring(data) # raises jsonschema.ValidationError on failure`,
8282

8383
<section id="core-usage" class="section">
8484
<div class="container">
85-
<h2 class="section-title">Diagram as a Code</h2>
86-
<p class="section-subtitle">
85+
<h2 class="section-title scroll-reveal">Diagram as a Code</h2>
86+
<p class="section-subtitle scroll-reveal">
8787
Build, validate, and visualize wiring configurations programmatically with
8888
<code class="inline-code">cryowire</code>.
8989
</p>
90-
<div class="core-install">
90+
<div class="core-install scroll-reveal">
9191
<code>pip install cryowire</code>
9292
</div>
93-
<div class="examples">
93+
<div class="examples scroll-stagger">
9494
{
9595
examples.map((example, i) => (
9696
<div class="example-card">
@@ -104,26 +104,36 @@ validate_wiring(data) # raises jsonschema.ValidationError on failure`,
104104
<div class="example-code-wrapper">
105105
<Code code={example.code} lang={example.lang} theme="github-dark" />
106106
</div>
107+
{i === 2 && (
108+
<div class="diagram-output">
109+
<div class="diagram-output-label">Output: wiring.svg</div>
110+
<div class="diagram-output-perspective">
111+
<div class="diagram-output-frame">
112+
<img src="/wiring.svg" alt="Wiring diagram generated by cryowire" class="diagram-output-img" />
113+
</div>
114+
</div>
115+
</div>
116+
)}
107117
</div>
108118
))
109119
}
110120
</div>
111-
<div class="core-links">
121+
<div class="core-links scroll-reveal">
112122
<a
113-
href="https://cryowire.github.io/core/"
123+
href="https://cryowire.github.io/cryowire/playground/"
114124
target="_blank"
115125
rel="noopener noreferrer"
116126
class="core-link"
117127
>
118-
API Reference
128+
Playground
119129
</a>
120130
<a
121-
href="https://github.com/cryowire/cryowire/blob/main/examples/getting_started.py"
131+
href="https://cryowire.github.io/core/"
122132
target="_blank"
123133
rel="noopener noreferrer"
124134
class="core-link core-link-secondary"
125135
>
126-
Interactive Notebook
136+
API Reference
127137
</a>
128138
</div>
129139
</div>
@@ -222,6 +232,46 @@ validate_wiring(data) # raises jsonschema.ValidationError on failure`,
222232
font-family: var(--font-mono);
223233
}
224234

235+
.diagram-output {
236+
border-top: 1px solid var(--color-border);
237+
padding: 1.5rem 1.5rem 2rem;
238+
}
239+
240+
.diagram-output-label {
241+
font-family: var(--font-mono);
242+
font-size: 0.75rem;
243+
color: var(--color-text-muted);
244+
margin-bottom: 1.25rem;
245+
}
246+
247+
.diagram-output-perspective {
248+
display: flex;
249+
justify-content: center;
250+
perspective: 1000px;
251+
overflow: hidden;
252+
padding: 1rem 0;
253+
}
254+
255+
.diagram-output-frame {
256+
background: #ffffff;
257+
border-radius: 0.5rem;
258+
padding: 1rem;
259+
box-shadow:
260+
0 20px 60px rgba(0, 0, 0, 0.4),
261+
0 0 0 1px rgba(56, 189, 248, 0.15),
262+
0 0 40px rgba(56, 189, 248, 0.06);
263+
max-width: 320px;
264+
will-change: transform, opacity;
265+
transform: translateX(120%) rotateY(-25deg) rotateZ(3deg);
266+
opacity: 0;
267+
}
268+
269+
.diagram-output-img {
270+
display: block;
271+
width: 100%;
272+
height: auto;
273+
}
274+
225275
.core-links {
226276
display: flex;
227277
justify-content: center;
@@ -259,3 +309,4 @@ validate_wiring(data) # raises jsonschema.ValidationError on failure`,
259309
color: var(--color-text);
260310
}
261311
</style>
312+

src/components/Ecosystem.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ const repos = [
7272

7373
<section id="ecosystem" class="section ecosystem-section">
7474
<div class="container">
75-
<h2 class="section-title">Ecosystem</h2>
76-
<p class="section-subtitle">
75+
<h2 class="section-title scroll-reveal">Ecosystem</h2>
76+
<p class="section-subtitle scroll-reveal">
7777
A modular, well-separated architecture across nine repositories.
7878
</p>
79-
<div class="ecosystem-grid">
79+
<div class="ecosystem-grid scroll-stagger">
8080
{
8181
repos.map((repo) => (
8282
<div class="repo-card">

src/components/Features.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ const features = [
4141

4242
<section id="features" class="section">
4343
<div class="container">
44-
<h2 class="section-title">Features</h2>
45-
<p class="section-subtitle">
44+
<h2 class="section-title scroll-reveal">Features</h2>
45+
<p class="section-subtitle scroll-reveal">
4646
Everything you need to document, validate, and visualize your dilution
4747
refrigerator wiring.
4848
</p>
49-
<div class="features-grid">
49+
<div class="features-grid scroll-stagger">
5050
{
5151
features.map((feature) => (
5252
<div class="feature-card">

src/components/Hero.astro

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,33 @@ import { HeroDiagram } from "./HeroDiagram";
55
<section class="hero">
66
<div class="hero-bg"></div>
77
<div class="container hero-content">
8-
<p class="hero-badge">Open Source &middot; Apache License 2.0</p>
9-
<h1 class="hero-title">
8+
<p class="hero-badge scroll-reveal">Open Source &middot; Apache License 2.0</p>
9+
<h1 class="hero-title scroll-reveal">
1010
Documentation for<br />
1111
<span class="hero-highlight">cryogenic wiring</span>
1212
</h1>
13-
<p class="hero-description">
13+
<p class="hero-description scroll-reveal">
1414
A comprehensive suite of tools for managing and visualizing dilution
1515
refrigerator wiring configurations for quantum computing systems.
1616
</p>
17-
<div class="hero-actions">
17+
<div class="hero-actions scroll-reveal">
1818
<a
19-
href="https://cryowire.github.io/viewer/"
19+
href="https://cryowire.github.io/cryowire/playground/"
2020
target="_blank"
2121
rel="noopener noreferrer"
2222
class="btn btn-primary"
23+
>
24+
Try the Playground
25+
</a>
26+
<a
27+
href="https://cryowire.github.io/viewer/"
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
class="btn btn-viewer"
2331
>
2432
Try the Viewer
2533
</a>
26-
<a href="#quickstart" class="btn btn-viewer">Get Started</a>
34+
<a href="#quickstart" class="btn btn-secondary">Get Started</a>
2735
<a
2836
href="https://github.com/cryowire"
2937
target="_blank"
@@ -33,7 +41,7 @@ import { HeroDiagram } from "./HeroDiagram";
3341
View on GitHub
3442
</a>
3543
</div>
36-
<div class="hero-demo">
44+
<div class="hero-demo scroll-reveal-scale">
3745
<a
3846
href="https://cryowire.github.io/viewer/"
3947
target="_blank"
@@ -152,6 +160,16 @@ import { HeroDiagram } from "./HeroDiagram";
152160
color: var(--color-accent);
153161
}
154162

163+
.btn-secondary {
164+
border: 1px solid var(--color-border);
165+
color: var(--color-text-muted);
166+
}
167+
168+
.btn-secondary:hover {
169+
border-color: rgba(56, 189, 248, 0.3);
170+
color: var(--color-text);
171+
}
172+
155173
.btn-outline {
156174
border: 1px solid var(--color-border);
157175
color: var(--color-text);

src/components/QuickStart.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ cryowire validate my-cryo/2026/cd001/`,
5959

6060
<section id="quickstart" class="section">
6161
<div class="container">
62-
<h2 class="section-title">Quick Start</h2>
63-
<p class="section-subtitle">
62+
<h2 class="section-title scroll-reveal">Quick Start</h2>
63+
<p class="section-subtitle scroll-reveal">
6464
Get up and running with cryowire in minutes.
6565
</p>
66-
<div class="steps">
66+
<div class="steps scroll-stagger">
6767
{
6868
steps.map((item) => (
6969
<div class="step-card">

src/pages/index.astro

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,67 @@ import Footer from "../components/Footer.astro";
2222
</main>
2323
<Footer />
2424
</Layout>
25+
26+
<script>
27+
function lerp(a: number, b: number, t: number) {
28+
return a + (b - a) * t;
29+
}
30+
31+
function updateScrollReveal() {
32+
const vh = window.innerHeight;
33+
34+
document.querySelectorAll<HTMLElement>('.scroll-reveal').forEach((el) => {
35+
const rect = el.getBoundingClientRect();
36+
const t = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
37+
el.style.opacity = String(t);
38+
el.style.transform = `translateY(${lerp(32, 0, t)}px)`;
39+
});
40+
41+
document.querySelectorAll<HTMLElement>('.scroll-reveal-left').forEach((el) => {
42+
const rect = el.getBoundingClientRect();
43+
const t = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
44+
el.style.opacity = String(t);
45+
el.style.transform = `translateX(${lerp(-48, 0, t)}px)`;
46+
});
47+
48+
document.querySelectorAll<HTMLElement>('.scroll-reveal-right').forEach((el) => {
49+
const rect = el.getBoundingClientRect();
50+
const t = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
51+
el.style.opacity = String(t);
52+
el.style.transform = `translateX(${lerp(48, 0, t)}px)`;
53+
});
54+
55+
document.querySelectorAll<HTMLElement>('.scroll-reveal-scale').forEach((el) => {
56+
const rect = el.getBoundingClientRect();
57+
const t = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
58+
el.style.opacity = String(t);
59+
el.style.transform = `scale(${lerp(0.92, 1, t)})`;
60+
});
61+
62+
// Staggered children
63+
document.querySelectorAll<HTMLElement>('.scroll-stagger').forEach((parent) => {
64+
const rect = parent.getBoundingClientRect();
65+
const baseT = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
66+
parent.querySelectorAll<HTMLElement>(':scope > *').forEach((child, i) => {
67+
const t = Math.max(0, Math.min(1, baseT - i * 0.08));
68+
child.style.opacity = String(t);
69+
child.style.transform = `translateY(${lerp(24, 0, t)}px)`;
70+
});
71+
});
72+
73+
// Diagram SVG perspective slide-in
74+
document.querySelectorAll<HTMLElement>('.diagram-output-frame').forEach((el) => {
75+
const rect = el.getBoundingClientRect();
76+
const t = Math.max(0, Math.min(1, (vh - rect.top) / (vh * 0.5)));
77+
const translateX = lerp(120, 0, t);
78+
const rotateY = lerp(-25, -6, t);
79+
const rotateZ = lerp(3, 0, t);
80+
el.style.transform = `translateX(${translateX}%) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg)`;
81+
el.style.opacity = String(Math.min(1, t * 2));
82+
});
83+
}
84+
85+
window.addEventListener('scroll', updateScrollReveal, { passive: true });
86+
window.addEventListener('resize', updateScrollReveal, { passive: true });
87+
updateScrollReveal();
88+
</script>

src/styles/global.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,28 @@ a:hover {
6868
max-width: 640px;
6969
margin: 0 auto 3rem;
7070
}
71+
72+
/* ── Scroll-driven reveal animations ─────────────────────── */
73+
.scroll-reveal {
74+
opacity: 0;
75+
transform: translateY(32px);
76+
will-change: transform, opacity;
77+
}
78+
79+
.scroll-reveal-left {
80+
opacity: 0;
81+
transform: translateX(-48px);
82+
will-change: transform, opacity;
83+
}
84+
85+
.scroll-reveal-right {
86+
opacity: 0;
87+
transform: translateX(48px);
88+
will-change: transform, opacity;
89+
}
90+
91+
.scroll-reveal-scale {
92+
opacity: 0;
93+
transform: scale(0.92);
94+
will-change: transform, opacity;
95+
}

0 commit comments

Comments
 (0)