summaryrefslogtreecommitdiff
path: root/examples/blog-multiple-authors/src/components/PostPreview.astro
blob: 19e1362e51844f65f3729c90762cadeb4f4251a7 (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
export interface Props {
  post: any;
  author: string;
}
const { post, author } = Astro.props;

function formatDate(date) {
  return new Date(date).toUTCString().replace(/(\d\d\d\d) .*/, '$1'); // remove everything after YYYY
}
---

<style lang="scss">
.post {
  padding-top: 6rem;
  padding-bottom: 6rem;
  border-bottom: 1px solid rgba(black, 0.25);
  text-align: center;
}

.author {
  text-transform: uppercase;
}

.date {
  font-style: italic;
}

.description {
  font-size: 1.25em;
}

.link {
  text-transform: uppercase;
  font-size: 0.8em;
  margin-left: 1em;
}

h2 {
  font-weight: 700;
  font-size: 2.75em;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-top: 0;
  margin-bottom: 0;
}

time {
  display: block;
  margin-top: 0.25rem;
  margin-bottom: 0.5em;
}
</style>

<article class="post">

  <div class="data">
    <h2>{post.title}</h2>
    <a class="author" href={`/authors/${post.author}`}>{author.name}</a>
    <time class="date" datetime={post.date}>{formatDate(post.date)}</time>
    <p class="description">
      {post.description}
      <a class="link" href={post.url} aria-label={`Read ${post.title}`}>Read</a>
    </p>
  </div>
</article>
r>2023-03-31supporting top of await (#6671)Gravatar wulinsheng123 7-5/+63 2023-03-31[ci] release (#6694)astro@2.1.9@astrojs/rss@2.3.2@astrojs/react@2.1.1@astrojs/lit@2.0.0@astrojs/image@0.16.4Gravatar Houston (Bot) 59-143/+131 2023-03-31fix(check): Dynamically import check command (#6717)Gravatar Erika 2-1/+7 2023-03-31fix(errors): Add simplified message for MarkdownImageNotFound (#6718)Gravatar Erika 1-0/+2 2023-03-31[ci] formatGravatar Princesseuh 1-2/+2 2023-03-31Fix incorrect path in error overlay on Win (#6679)Gravatar Peter Timoshevsky 5-5/+43 2023-03-30Remove unnecessary image-related `.wasm` files inside build output when possi...Gravatar Erika 6-47/+45 2023-03-30Fix InferGetStaticParamsType and InferGetStaticPropsType not working with syn...Gravatar Erika 2-7/+16 2023-03-30Fix multiple images being generated for the same image (#6710)Gravatar Erika 6-15/+28 2023-03-30[RSS] Fix: update `RSSFeedItem` type to comply with `strictest` tsconfig (#6614)Gravatar Aivars Liepa 2-1/+6 2023-03-29Update lit-ssr dependency (#6681)Gravatar Elliott Marquez 13-82/+107 2023-03-29fix(images): Improve error handling around the new assets feature (#6649)Gravatar Erika 17-21/+290 2023-03-29Use debug option for debugDir (#6554)Gravatar Isaac 1-1/+1