Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nsaunders committed Jul 29, 2023
1 parent 255adef commit aeed2b7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
16 changes: 7 additions & 9 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import PostListItem from "@/components/PostListItem";
import Typography from "@/components/Typography";
import * as Posts from "@/data/Posts";
import * as Projects from "@/data/Projects";
import * as Project from "@/data/Project";
import exhausted from "@/utils/exhausted";
import * as meta from "@/meta";
import ProjectListItem from "@/components/ProjectListItem";
Expand All @@ -18,7 +19,11 @@ export const metadata = {

export default async function Home() {
const latestPost = await Posts.getByLatest();
const [featuredProject] = await Projects.list();
const featuredProject = await Projects.getFeatured();
const projectSummary = await Project.getSummary(
featuredProject.name,
featuredProject.owner
);
return (
<main>
<Article
Expand Down Expand Up @@ -107,14 +112,7 @@ export default async function Home() {
<ProjectListItem {...featuredProject} />
</div>
<Paragraph style={{ margin: 0, flex: 1, minWidth: "30ch" }}>
With Tecton, you can confidently author CSS using a
statically-typed language, protecting you from a wide range of
CSS errors—some rather obscure. I built Tecton after finding
other statically-typed CSS solutions to be cumbersome and
outdated, limited to subsets of CSS that would not meet the
needs of most real-world projects. On the other hand, Tecton
uses advanced features of PureScript to deliver a familiar yet
safe CSS authoring experience.
{projectSummary}
</Paragraph>
</Surface>
<LinkAnchor href="/projects">
Expand Down
7 changes: 6 additions & 1 deletion src/app/posts/[name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export default async function Page({ params: { name } }: Props) {
<img
src={resolveURL(post.imageBase, src)}
alt={alt || ""}
style={{ display: "block", margin: "2em auto", ...style }}
style={{
display: "block",
margin: "2em auto",
maxWidth: "100%",
...style,
}}
{...restProps}
/>
) : (
Expand Down
9 changes: 9 additions & 0 deletions src/data/Project.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export async function getSummary(name: string, owner: string) {
const res = await fetch(
`https://raw.githubusercontent.com/nsaunders/writing/master/projects/${owner}/${name}.md`
);
if (!res.ok) {
throw new Error(`Unexpected response ${res.status} (${res.statusText})`);
}
return await res.text();
}
8 changes: 6 additions & 2 deletions src/data/Projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export async function list() {
parseInt($(this).find("a[href$='forks']").text().trim()) || 0;
return {
url: `https://github.com/${owner}/${name}`,
owner:
owner === username ? { tag: "self" } : { tag: "other", name: owner },
owner,
name,
description,
language: { name: languageName, color: languageColor },
Expand All @@ -41,3 +40,8 @@ export async function list() {
})
.toArray();
}

export async function getFeatured() {
const [featured] = await list();
return featured;
}

0 comments on commit aeed2b7

Please sign in to comment.