Skip to content
Merged
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
3 changes: 3 additions & 0 deletions docs/public/teams-line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/features/build-insights.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
169 changes: 169 additions & 0 deletions docs/src/components/Feature.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
---
import { Image } from "astro:assets";
import { marked } from "marked";
import type { CollectionEntry } from "astro:content";

interface Props {
data: CollectionEntry<"feature">["data"];
}

const {
data: { asset, tagLine, name },
} = Astro.props;
const parsedCaption = asset.caption
? marked.parseInline(asset.caption)
: undefined;
---

<style>
article {
row-gap: 2rem;
}

.figure {
margin: 0;

@media (min-width: 800px) {
grid-column: var(--image-column);
}
}

.figure--before-content {
grid-row: 1;
}

figcaption {
margin-top: 1rem;

text-align: center;
}

.image {
width: 100%;
height: auto;

border-radius: 1.25rem;
}

.feature-content {
@media (min-width: 800px) {
grid-column: var(--content-column);
align-self: center;
}
}

.feature-content__content {
& :global(strong) {
font-weight: 400;
}

& :global(p) {
margin: 0 0 1rem;
}
}

.feature-content__content--big {
& :global(p) {
margin-top: 2rem;

font-size: 1.5rem;
font-weight: 600;
color: var(--text-color-light);
line-height: 1.33341;
letter-spacing: -0.003em;
}
}

.title {
margin: 0 0 0.5rem;

font-size: 2rem;
font-weight: 500;
line-height: 1.2;
}

.title--big {
font-size: 3rem;
line-height: 1.05556;
font-weight: 600;
letter-spacing: -0.006em;

@media (min-width: 800px) {
font-size: 4.5rem;
}
}

.title--dim {
color: var(--text-color);
}
</style>

<article class="grid">
<div
class="feature-content"
style={{
"--content-column":
asset.alignment === "full-width"
? "2 / -2"
: `${asset.alignment === "left" ? `span ${12 - asset.columnSpan}` : 1} / ${asset.alignment === "left" ? -1 : `span ${12 - asset.columnSpan}`}`,
}}
>
<h3
class:list={[
"title",
{
"title--dim": !!tagLine,
"title--big": asset.alignment === "full-width",
},
]}
>
{name}
</h3>
{tagLine ? <h4 class:list={["title", "title--big"]}>{tagLine}</h4> : null}
<div
class:list={[
"feature-content__content",
{
"feature-content__content--big": asset.alignment === "full-width",
},
]}
>
<slot />
</div>
</div>
<figure
class:list={[
"figure",
{ "figure--before-content": asset.alignment === "left" },
]}
style={{
"--image-column":
asset.alignment === "full-width"
? "1 / -1"
: `${asset.alignment === "left" ? 1 : `span ${asset.columnSpan}`} / ${asset.alignment === "left" ? `span ${asset.columnSpan}` : -1}`,
}}
>
{
asset.type === "image" ? (
<Image
src={asset.path}
alt={asset.alt}
class="image"
widths={[640, 800, 1200, 1500]}
sizes="(max-width: 375px) 20rem, ((min-width: 376px) and (max-width: 799px)) 40rem, ((min-width: 800px) and (max-width: 1050px)) 37.5rem, 47.5rem"
/>
) : (
<video
class="image"
src={asset.path}
aria-label={asset.alt}
autoplay
muted
playsinline
loop
/>
)
}
{parsedCaption ? <figcaption set:html={parsedCaption} /> : null}
</figure>
</article>
170 changes: 9 additions & 161 deletions docs/src/components/Features.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { getCollection, render } from "astro:content";
import { Image } from "astro:assets";
import { marked } from "marked";

import Feature from "./Feature.astro";

const rawFeatures = await getCollection("feature");
const features = await Promise.all(
Expand All @@ -12,23 +12,13 @@ const features = await Promise.all(
return {
...feature,
Content,
data: {
...feature.data,
asset: {
...feature.data.asset,
caption: feature.data.asset.caption
? marked.parseInline(feature.data.asset.caption)
: undefined,
},
},
};
}),
);
---

<style>
article {
row-gap: 2rem;
.feature-wrapper {
margin-top: 4rem;
margin-bottom: 4rem;

Expand All @@ -37,158 +27,16 @@ const features = await Promise.all(
margin-bottom: 8rem;
}
}

.figure {
margin: 0;

@media (min-width: 800px) {
grid-column: var(--image-column);
}
}

.figure--before-content {
grid-row: 1;
}

figcaption {
margin-top: 1rem;

text-align: center;
}

.image {
width: 100%;
height: auto;

border-radius: 1.25rem;
}

.feature-content {
@media (min-width: 800px) {
grid-column: var(--content-column);
align-self: center;
}
}

.feature-content__content {
& :global(strong) {
font-weight: 400;
}

& :global(p) {
margin: 0 0 1rem;
}
}

.feature-content__content--big {
& :global(p) {
margin-top: 2rem;

font-size: 1.5rem;
font-weight: 600;
color: var(--text-color-light);
line-height: 1.33341;
letter-spacing: -0.003em;
}
}

.title {
margin: 0 0 0.5rem;

font-size: 2rem;
font-weight: 500;
line-height: 1.2;
}

.title--big {
font-size: 3rem;
line-height: 1.05556;
font-weight: 600;
letter-spacing: -0.006em;

@media (min-width: 800px) {
font-size: 4.5rem;
}
}

.title--dim {
color: var(--text-color);
}
</style>

<section aria-label="RocketSim features">
{
features.map(({ data: { asset, name, tagLine }, Content }) => (
<article class="grid">
<div
class="feature-content"
style={{
"--content-column":
asset.alignment === "full-width"
? "2 / -2"
: `${asset.alignment === "left" ? `span ${12 - asset.columnSpan}` : 1} / ${asset.alignment === "left" ? -1 : `span ${12 - asset.columnSpan}`}`,
}}
>
<h3
class:list={[
"title",
{
"title--dim": !!tagLine,
"title--big": asset.alignment === "full-width",
},
]}
>
{name}
</h3>
{tagLine ? (
<h4 class:list={["title", "title--big"]}>{tagLine}</h4>
) : null}
<div
class:list={[
"feature-content__content",
{
"feature-content__content--big":
asset.alignment === "full-width",
},
]}
>
<Content />
</div>
</div>
<figure
class:list={[
"figure",
{ "figure--before-content": asset.alignment === "left" },
]}
style={{
"--image-column":
asset.alignment === "full-width"
? "1 / -1"
: `${asset.alignment === "left" ? 1 : `span ${asset.columnSpan}`} / ${asset.alignment === "left" ? `span ${asset.columnSpan}` : -1}`,
}}
>
{asset.type === "image" ? (
<Image
src={asset.path}
alt={asset.alt}
class="image"
widths={[640, 800, 1200, 1500]}
sizes="(max-width: 375px) 20rem, ((min-width: 376px) and (max-width: 799px)) 40rem, ((min-width: 800px) and (max-width: 1050px)) 37.5rem, 47.5rem"
/>
) : (
<video
class="image"
src={asset.path}
aria-label={asset.alt}
autoplay
muted
playsinline
loop
/>
)}
{asset.caption ? <figcaption set:html={asset.caption} /> : null}
</figure>
</article>
features.map(({ data, Content }) => (
<div class="feature-wrapper">
<Feature data={data}>
<Content />
</Feature>
</div>
))
}
</section>
6 changes: 3 additions & 3 deletions docs/src/components/SectionHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
interface Props {
title: string;
subtitle?: string;
text: string;
text?: string;
}

const { title, subtitle, text } = Astro.props;
Expand Down Expand Up @@ -48,7 +48,7 @@ const { title, subtitle, text } = Astro.props;
<h3 class:list={["title", { "title--dim": !!subtitle }]}>
{title}
</h3>
{!!subtitle ? <h4 class:list={["title"]}>{subtitle}</h4> : null}
<p>{text}</p>
{subtitle ? <h4 class:list={["title"]}>{subtitle}</h4> : null}
{text ? <p>{text}</p> : null}
</div>
</header>
Loading