Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/CopyCommand.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ interface Props {
}

const { command } = Astro.props;
// Each word is kept whole, so a long command wraps at spaces and never inside a package name or an option.
// A long command wraps at spaces. A word too long for the line, such as a package name on a phone, breaks after a dot.
const words = command.split(' ');
---

<div class="command">
<code><span class="prompt" aria-hidden="true">$</span> {words.map((w, i) => <Fragment>{i > 0 && ' '}<span class="word">{w}</span></Fragment>)}</code>
<code><span class="prompt" aria-hidden="true">$</span> {words.map((w, i) => <Fragment>{i > 0 && ' '}<span class="word">{w.split('.').map((part, j) => <Fragment>{j > 0 && <Fragment>.<wbr /></Fragment>}{part}</Fragment>)}</span></Fragment>)}</code>
<button type="button" class="copy" data-copy={command} aria-label={`Copy ${command}`} title="Copy">
<span class="when-idle"><Icon name="copy" /></span>
<span class="when-done"><Icon name="check" /></span>
Expand Down
23 changes: 12 additions & 11 deletions src/data/templates.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// The templates on the home page. Keys, names, packages and hues match scripts/brand.mjs in the brand repository.
// The templates on the home page. Keep each highlight to one short line, about 34 characters, so the cards line up.
// Keys, names, packages and hues match scripts/brand.mjs in the brand repository.

export interface Template {
key: string;
Expand All @@ -24,8 +25,8 @@ export const templates: Template[] = [
subject: 'ASP.NET Core Minimal APIs',
highlights: [
'Endpoints grouped by feature',
'OpenAPI from XML comments, browsed in Scalar',
'Problem Details errors and optional JWT bearer auth',
'OpenAPI docs browsed in Scalar',
'Problem Details, optional JWT auth',
],
},
{
Expand All @@ -38,8 +39,8 @@ export const templates: Template[] = [
hue: 'violet',
subject: 'Model Context Protocol servers',
highlights: [
'Six task-shaped tools, plus resources and prompts',
'Streamable HTTP, with the MCP Inspector in Docker Compose',
'Six tools, resources and prompts',
'MCP Inspector in Docker Compose',
'Optional OAuth protection',
],
},
Expand All @@ -53,8 +54,8 @@ export const templates: Template[] = [
hue: 'pink',
subject: 'GraphQL on Hot Chocolate',
highlights: [
'Hot Chocolate with the Nitro IDE built in',
'Relay cursor paging and DataLoaders',
'Hot Chocolate with Nitro built in',
'Relay paging and DataLoaders',
'Optional JWT bearer auth',
],
},
Expand All @@ -68,9 +69,9 @@ export const templates: Template[] = [
hue: 'blue',
subject: 'ASP.NET Core Web APIs',
highlights: [
'Controllers grouped by feature, kept thin by Mediator',
'OpenAPI from XML comments, browsed in Scalar',
'Problem Details errors and optional JWT bearer auth',
'Thin controllers, grouped by feature',
'OpenAPI docs browsed in Scalar',
'Problem Details, optional JWT auth',
],
},
{
Expand All @@ -84,7 +85,7 @@ export const templates: Template[] = [
subject: 'AWS Lambda',
highlights: [
'Packaged as a container image',
'Source-generated JSON for quick cold starts',
'Source-generated JSON, fast starts',
'Paging and search for every list',
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { shared, templates } from '../data/templates';
<section class="hero">
<div class="wrap hero-grid">
<div class="hero-copy">
<p class="eyebrow">dotnet new templates for .NET 10</p>
<p class="eyebrow">dotnet new templates for .NET&nbsp;10</p>
<h1>Clean Architecture templates for .NET, <span>minus the ceremony.</span></h1>
<p class="lede">
Five templates, one sensible core. Each one builds the same small movie review app on the same Application and
Expand Down
69 changes: 60 additions & 9 deletions src/styles/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ html {
}

body {
overflow-x: clip;
margin: 0;
background: var(--bg);
color: var(--text);
Expand Down Expand Up @@ -429,6 +430,42 @@ li {
text-decoration: underline;
}

/* On cards, links are badges that share the full width and sit on the bottom edge. */
.card .links {
gap: 0.5rem;
}

.card .links a {
flex: 1 1 0;
min-width: max-content;
justify-content: center;
}

.card .links a:not(.button) {
padding: 0.45rem 0.9rem;
border-radius: 999px;
border: 1px solid var(--border-strong);
color: var(--text);
line-height: 1.2;
transition:
border-color 150ms ease,
color 150ms ease;
}

.card .links a:not(.button):hover {
text-decoration: none;
border-color: var(--accent);
color: var(--accent);
}

@media (max-width: 30rem) {
.card .links a:not(.button) {
gap: 0.3rem;
padding-inline: 0.6rem;
font-size: 0.9rem;
}
}

/* Commands wrap at spaces instead of scrolling, with the prompt hanging out to the left. */
.commands {
display: grid;
Expand Down Expand Up @@ -457,7 +494,10 @@ li {
}

.commands .word {
white-space: nowrap;
display: inline-block;
max-width: 100%;
overflow-wrap: anywhere;
text-indent: 0;
}

.commands .copy {
Expand Down Expand Up @@ -488,11 +528,16 @@ li {
gap: 1.25rem;
}

/* Each template card spans four rows of the grid (head, highlights, commands, badges) and shares them with
its neighbours, so the parts line up across a row even when one card's text runs longer. */
.template {
--hue: var(--hue-dark);

display: flex;
flex-direction: column;
display: grid;
grid-row: span 4;
grid-template-rows: subgrid;
row-gap: 1.25rem;
align-content: start;
border-top: 4px solid var(--hue);
transition:
border-color 150ms ease,
Expand All @@ -509,7 +554,6 @@ li {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.25rem;
}

.template-head picture {
Expand Down Expand Up @@ -541,12 +585,21 @@ li {
.highlights {
list-style: none;
padding: 0;
margin: 0 0 1.25rem;
margin: 0;
display: grid;
align-content: start;
gap: 0.45rem;
font-size: 0.97rem;
}

.template .commands {
align-self: end;
}

.template .links {
padding-top: 0;
}

.highlights li {
position: relative;
padding-left: 1.2rem;
Expand All @@ -563,15 +616,13 @@ li {
background: var(--hue);
}

.template .links a:not(.button) {
color: var(--text);
}

.template .links a:not(.button):hover {
border-color: var(--hue);
color: var(--hue);
}

.shared {
grid-row: span 4;
display: flex;
flex-direction: column;
background: transparent;
Expand Down
Loading