Skip to content

Commit f13ab07

Browse files
committed
great success
1 parent 5332588 commit f13ab07

File tree

2 files changed

+133
-11
lines changed

2 files changed

+133
-11
lines changed

examples/shnippet-demo/src/App.css

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,90 @@
2626
color: #c7c9d9;
2727
}
2828

29+
.app__content {
30+
display: grid;
31+
gap: 2rem;
32+
width: min(90rem, 100%);
33+
margin: 0 auto;
34+
}
35+
36+
@media (min-width: 1024px) {
37+
.app__content {
38+
grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
39+
align-items: start;
40+
}
41+
}
42+
2943
.app__snippets {
3044
display: grid;
3145
gap: 1.5rem;
32-
width: min(60rem, 100%);
33-
margin: 0 auto;
46+
}
47+
48+
.app__sidebar {
49+
position: sticky;
50+
top: 2rem;
51+
}
52+
53+
.info-card {
54+
background: #12131d;
55+
border-radius: 1.25rem;
56+
padding: 1.75rem;
57+
border: 1px solid rgba(125, 211, 252, 0.18);
58+
box-shadow: 0 25px 55px rgba(12, 18, 36, 0.55);
59+
display: grid;
60+
gap: 1.25rem;
61+
}
62+
63+
.info-card h2 {
64+
margin: 0;
65+
font-size: 1.5rem;
66+
color: #e2e8f8;
67+
}
68+
69+
.info-card p {
70+
margin: 0;
71+
color: #cbd5f5;
72+
line-height: 1.6;
73+
}
74+
75+
.info-card__section {
76+
display: grid;
77+
gap: 0.65rem;
78+
}
79+
80+
.info-card__section h3 {
81+
margin: 0;
82+
color: #93c5fd;
83+
font-size: 1rem;
84+
letter-spacing: 0.08em;
85+
text-transform: uppercase;
86+
}
87+
88+
.info-card__section ul {
89+
margin: 0;
90+
padding-left: 1.1rem;
91+
display: grid;
92+
gap: 0.5rem;
93+
color: #cbd5f5;
94+
}
95+
96+
.info-card__link {
97+
color: #7dd3fc;
98+
font-weight: 600;
99+
text-decoration: none;
100+
align-self: flex-start;
101+
transition: color 0.2s ease;
102+
}
103+
104+
.info-card__link:hover {
105+
color: #bae6fd;
106+
text-decoration: underline;
107+
}
108+
109+
@media (max-width: 1023px) {
110+
.app__sidebar {
111+
position: static;
112+
}
34113
}
35114

36115
.snippet-card {

examples/shnippet-demo/src/App.tsx

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,60 @@ function App() {
5252
<p>Snippets generated from tests using the Shnippet CLI.</p>
5353
</header>
5454

55-
{isLoading ? (
56-
<p className="status">Loading snippets…</p>
57-
) : error ? (
58-
<p className="status status--error">{error}</p>
59-
) : (
55+
<div className="app__content">
6056
<section className="app__snippets">
61-
{snippets.map(({ data, description }) => (
62-
<SnippetCard key={data.name} snippet={data} description={description} />
63-
))}
57+
{isLoading ? (
58+
<p className="status">Loading snippets…</p>
59+
) : error ? (
60+
<p className="status status--error">{error}</p>
61+
) : (
62+
snippets.map(({ data, description }) => (
63+
<SnippetCard key={data.name} snippet={data} description={description} />
64+
))
65+
)}
6466
</section>
65-
)}
67+
68+
<aside className="app__sidebar" aria-label="Project details">
69+
<div className="info-card">
70+
<h2>How this example works</h2>
71+
<p>
72+
The tests in both TypeScript and Python are annotated with Shnippet tags. Running the
73+
CLI extracts the tagged regions and keeps the language tabs in sync with the generated
74+
snippet files.
75+
</p>
76+
77+
<div className="info-card__section">
78+
<h3>Try it locally</h3>
79+
<ul>
80+
<li>
81+
<code>pnpm --filter shnippet-demo test:run</code> — run the Vitest suite
82+
</li>
83+
<li>
84+
<code>pnpm --filter shnippet-demo test:python</code> — run the Python tests
85+
</li>
86+
<li>
87+
<code>pnpm --filter shnippet-demo shnippet</code> — regenerate snippets
88+
</li>
89+
</ul>
90+
</div>
91+
92+
<div className="info-card__section">
93+
<h3>Source reference</h3>
94+
<p>
95+
Browse the tests and configuration in the repository once it is published to GitHub.
96+
</p>
97+
<a
98+
className="info-card__link"
99+
href="https://github.com/shnippet/shnippet-demo"
100+
target="_blank"
101+
rel="noreferrer"
102+
>
103+
View on GitHub
104+
</a>
105+
</div>
106+
</div>
107+
</aside>
108+
</div>
66109
</main>
67110
);
68111
}

0 commit comments

Comments
 (0)