Skip to content

Commit

Permalink
relative links
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Mar 11, 2024
1 parent cb17923 commit 9024468
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/components/comment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createSignal, For, Show } from "solid-js";
import { A } from "@solidjs/router";
import type { CommentDefinition } from "../types";

const pluralize = (n: number) => n + (n === 1 ? " reply" : " replies");
Expand All @@ -9,7 +10,7 @@ export default function Comment(props: { comment: CommentDefinition }) {
return (
<li class="comment">
<div class="by">
<a href={`/users/${props.comment.user}`}>{props.comment.user}</a>{" "}
<A href={`/users/${props.comment.user}`}>{props.comment.user}</A>{" "}
{props.comment.time_ago} ago
</div>
<div class="text" innerHTML={props.comment.content} />
Expand Down
26 changes: 14 additions & 12 deletions src/components/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
import { A } from "@solidjs/router";

export default function Nav() {
return (
<header class="header" $ServerOnly>
<nav class="inner">
<a href="/">
<A href="/">
<strong>HN</strong>
</a>
<a href="/new">
</A>
<A href="/new">
<strong>New</strong>
</a>
<a href="/show">
</A>
<A href="/show">
<strong>Show</strong>
</a>
<a href="/ask">
</A>
<A href="/ask">
<strong>Ask</strong>
</a>
<a href="/job">
</A>
<A href="/job">
<strong>Jobs</strong>
</a>
<a
</A>
<A
class="github"
href="https://github.com/solidjs/solid"
target="_blank"
rel="noreferrer"
>
Built with Solid
</a>
</A>
</nav>
</header>
);
Expand Down
9 changes: 5 additions & 4 deletions src/routes/[...stories].tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
createAsync,
A,
type RouteDefinition,
cache,
type RouteSectionProps,
Expand Down Expand Up @@ -48,13 +49,13 @@ export default function Stories(props: RouteSectionProps) {
</span>
}
>
<a
<A
class="page-link"
href={`/${type()}?page=${page() - 1}`}
aria-label="Previous Page"
>
{"<"} prev
</a>
</A>
</Show>
<span>page {page()}</span>
<Show
Expand All @@ -65,13 +66,13 @@ export default function Stories(props: RouteSectionProps) {
</span>
}
>
<a
<A
class="page-link"
href={`/${type()}?page=${page() + 1}`}
aria-label="Next Page"
>
more {">"}
</a>
</A>
</Show>
</div>
<main class="news-list">
Expand Down
7 changes: 4 additions & 3 deletions src/routes/stories/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
cache,
createAsync,
A,
type RouteDefinition,
type RouteSectionProps,
} from "@solidjs/router";
Expand All @@ -25,15 +26,15 @@ export default function Story(props: RouteSectionProps) {
<Show when={story()}>
<div class="item-view">
<div class="item-view-header">
<a href={story()!.url} target="_blank">
<A href={story()!.url} target="_blank">
<h1>{story()!.title}</h1>
</a>
</A>
<Show when={story()!.domain}>
<span class="host">({story()!.domain})</span>
</Show>
<p class="meta">
{story()!.points} points | by{" "}
<a href={`/users/${story()!.user}`}>{story()!.user}</a>{" "}
<A href={`/users/${story()!.user}`}>{story()!.user}</A>{" "}
{story()!.time_ago} ago
</p>
</div>
Expand Down

0 comments on commit 9024468

Please sign in to comment.