Skip to content

Commit

Permalink
Merge pull request #35 from torontojs/feat/report_input
Browse files Browse the repository at this point in the history
Feat/report input
  • Loading branch information
dreymoreau authored Jul 26, 2024
2 parents 412aab0 + f4cf525 commit b12ae5f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/components/PageHeader/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
width: auto;
margin: 1.25rem auto;
padding: 0 1rem;
text-align: center;

@media (min-width: 1024px) {
.desktop\:px-9 {
Expand All @@ -11,4 +12,5 @@
font-weight: 300;
}
}

}
24 changes: 9 additions & 15 deletions src/components/PostCard/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Picture } from 'astro:assets';
import TagList from '../TagList/index.astro';
import './styles.css';
interface Props {
url: string,
title: string,
Expand All @@ -19,24 +21,16 @@ const BLOG_URL = Astro.site?.href;
const IMAGE_WIDTHS = [256, 512, 768, image?.width ?? 1024];
const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeStyle: 'short' });
---
<article
class:list={[
'post-card bg-gradient-to-t rounded-3xl p-4 hover:from-yellow to-transparent grid gap-2 shadow-md',
{
'grid-cols-[auto] desktop:grid-cols-[min-content_auto] grid-rows-[auto_auto_auto_auto_auto] desktop:grid-rows-[auto_1fr_auto_auto]': image,
'grid-cols-[auto] grid-rows-[auto_auto_auto]': !image
}
]}
>
<article class="post-card">

<header class:list={['col-start-1', { 'desktop:col-span-2': image }]}>
<h2 class="text-2xl font-light">
<header>
<h2>
<a href={url}>
<slot name="title"></slot>
</a>
</h2>

<span class="text-sm"><time datetime={new Date(createdAt).toISOString()}>{formatter.format(new Date(createdAt))}</time></span>
<span><time datetime={new Date(createdAt).toISOString()}>{formatter.format(new Date(createdAt))}</time></span>
</header>

{image && (
Expand All @@ -50,13 +44,13 @@ const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeStyl
/>
)}

<div class:list={['post-card-content row-start-3 desktop:row-start-2', { 'col-start-1 desktop:col-start-2': image }]}>
<div>
<slot></slot>
</div>

<a class:list={['read-more-link row-start-4 desktop:row-start-3 underline underline-offset-2 decoration-2 decoration-mainRed hover:decoration-lightRed hover:decoration-4', { 'col-start-1 desktop:col-start-2': image }]} href={url}><span class="sr-only">({title}) </span>Read more...</a>
<a href={url}><span class="sr-only">({title}) </span>Read more...</a>

<footer class:list={['col-start-1 row-start-5 desktop:row-start-4', { 'desktop:col-span-2': image }]}>
<footer>
{tags && tags.length > 0 && (
<TagList
tags={Object.fromEntries(tags.map((tag) => [tag, `${BLOG_URL}tags/${tag}`]))}
Expand Down
14 changes: 14 additions & 0 deletions src/components/PostCard/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.post-card {
border-radius: 5px;
border: 5px solid #ED342F;
padding: 20px;
width: 75%;
margin: 2rem auto;
text-align: center;
}

img {
display: block;
margin-left: auto;
margin-right: auto;
}
1 change: 1 addition & 0 deletions src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PostHeader from '../components/PostHeader/index.astro';
import SkipToContent from '../components/SkipToContent/index.astro';
import TagList from '../components/TagList/index.astro';
import BaseLayout from './Base/index.astro';
import './styles.css';
interface Props {
title: string,
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/BlogPosts.astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
import type { Post } from '../utils/post';
import PageHeader from '../components/PageHeader/index.astro';
import Pagination from '../components/Pagination/index.astro';
import PostCard from '../components/PostCard/index.astro';
import SiteNav from '../components/SiteNav/index.astro';
import SkipToContent from '../components/SkipToContent/index.astro';
import type { Post } from '../utils/post';
import BaseLayout from './Base/index.astro';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/report.astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const BLOG_URL = Astro.site?.href;
</div>
</div>

<div>
<div id="report-form">
<form>
<label for="name">
Name
Expand Down
34 changes: 33 additions & 1 deletion src/styles/report.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.fullWidth {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -30,3 +29,36 @@ h1 {
border-radius: 10px;
border: 2px solid black;
}

#report-form {
border-radius: 5px;
border: 5px solid #ED342F;
padding: 20px;
width: 75%;
margin: 0 auto;
}

#report-form :is(input, textarea) {
width: 100%;
padding: 12px;
border: 1px solid #cccccc;
border-radius: 4px;
resize: vertical;
}

#report-form label {
padding: 12px 12px 12px 0;
display: inline-block;
}

#report-form input {
margin-block-start: 20px;
}

#report-form button[type="submit"]{
background: #ED342F;
}

#report-form button[type="submit"]:hover{
background: #A8569A;
}

0 comments on commit b12ae5f

Please sign in to comment.