-
Notifications
You must be signed in to change notification settings - Fork 418
Expand file tree
/
Copy pathstory.tsx
More file actions
41 lines (38 loc) · 1.29 KB
/
story.tsx
File metadata and controls
41 lines (38 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { A } from "@solidjs/router";
import { Component, Show } from "solid-js";
import type { StoryDefinition } from "../types";
const Story: Component<{ story: StoryDefinition }> = props => {
return (
<li class="news-item">
<span class="score">{props.story.points}</span>
<span class="title">
<Show
when={props.story.url}
fallback={<A href={`/stories/${props.story.id}`}>{props.story.title}</A>}
>
<a href={props.story.url} target="_blank" rel="noreferrer">
{props.story.title}
</a>
<span class="host"> ({props.story.domain})</span>
</Show>
</span>
<br />
<span class="meta">
<Show
when={props.story.type !== "job"}
fallback={<A href={`/stories/${props.story.id}`}>{props.story.time_ago}</A>}
>
by <A href={`/users/${props.story.user}`}>{props.story.user}</A> {props.story.time_ago} |{" "}
<A href={`/stories/${props.story.id}`}>
{props.story.comments_count ? `${props.story.comments_count} comments` : "discuss"}
</A>
</Show>
</span>
<Show when={props.story.type !== "link"}>
{" "}
<span class="label">{props.story.type}</span>
</Show>
</li>
);
};
export default Story;