Skip to content

Commit

Permalink
style: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Apr 1, 2024
1 parent b0fec9d commit 4aa33ad
Show file tree
Hide file tree
Showing 34 changed files with 521 additions and 372 deletions.
11 changes: 11 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
plugins: [require.resolve("prettier-plugin-astro")],
overrides: [
{
files: "*.astro",
options: {
parser: "astro",
},
},
],
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@
"tailwind-merge": "^2.2.2",
"tailwindcss": "^3.4.1",
"typescript": "^5.4.2"
},
"devDependencies": {
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0"
}
}
52 changes: 46 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 34 additions & 12 deletions src/components/ArrowCard.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
import { dateRange } from "@lib/utils";
import type { CollectionKey } from "astro:content";
import type { CollectionEntry } from "astro:content";
interface Entry {
data: {
title: string;
description: string;
}
};
}
interface ClickableCollectionEntry extends Entry {
Expand All @@ -21,32 +20,55 @@ interface DateRangeEntry extends Entry {
description: string;
dateStart: Date;
dateEnd: string | Date | undefined;
}
};
}
type Props = {
entry: Entry | ClickableCollectionEntry | DateRangeEntry | (DateRangeEntry & ClickableCollectionEntry);
}
entry:
| Entry
| ClickableCollectionEntry
| DateRangeEntry
| (DateRangeEntry & ClickableCollectionEntry);
};
const { entry } = Astro.props;
const href = "collection" in entry ? `/${entry.collection}/${entry.slug}` : "#";
---

<a href={href} class="relative group flex flex-nowrap py-3 px-4 pr-10 rounded-lg border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out">
<a
href={href}
class="relative group flex flex-nowrap py-3 px-4 pr-10 rounded-lg border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out"
>
<div class="flex flex-col flex-1 truncate">
{"dateStart" in entry.data ? <div class="text-sm opacity-75 pb-1">{dateRange(entry.data.dateStart, entry.data.dateEnd)}</div> : <></>}
{
"dateStart" in entry.data ? (
<div class="text-sm opacity-75 pb-1">
{dateRange(entry.data.dateStart, entry.data.dateEnd)}
</div>
) : null
}
<div class="font-semibold">
{entry.data.title}
</div>
<div class="text-sm">
{entry.data.description}
</div>
</div>
<svg
xmlns="http://www.w3.org/2000/svg"
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
class="absolute top-1/2 right-2 -translate-y-1/2 size-5 stroke-2 fill-none stroke-current">
<line x1="5" y1="12" x2="19" y2="12" class="translate-x-3 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out" />
<polyline points="12 5 19 12 12 19" class="-translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out" />
class="absolute top-1/2 right-2 -translate-y-1/2 size-5 stroke-2 fill-none stroke-current"
>
<line
x1="5"
y1="12"
x2="19"
y2="12"
class="translate-x-3 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out"
></line>
<polyline
points="12 5 19 12 12 19"
class="-translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out"
></polyline>
</svg>
</a>
31 changes: 22 additions & 9 deletions src/components/BackToPrev.astro
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
---
type Props = {
href: string;
}
};
const { href } = Astro.props;
---

<a href={href} class="relative group w-fit flex pl-7 pr-3 py-1.5 flex-nowrap rounded border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out">
<svg
xmlns="http://www.w3.org/2000/svg"

<a
href={href}
class="relative group w-fit flex pl-7 pr-3 py-1.5 flex-nowrap rounded border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
class="absolute top-1/2 left-2 -translate-y-1/2 size-4 stroke-2 fill-none stroke-current">
<line x1="5" y1="12" x2="19" y2="12" class="translate-x-2 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out" />
<polyline points="12 5 5 12 12 19" class="translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out" />
class="absolute top-1/2 left-2 -translate-y-1/2 size-4 stroke-2 fill-none stroke-current"
>
<line
x1="5"
y1="12"
x2="19"
y2="12"
class="translate-x-2 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out"
></line>
<polyline
points="12 5 5 12 12 19"
class="translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out"
></polyline>
</svg>
<div class="text-sm">
<slot/>
<slot />
</div>
</a>
31 changes: 21 additions & 10 deletions src/components/BackToTop.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
<button id="back-to-top" class="relative group w-fit flex pl-8 pr-3 py-1.5 flex-nowrap rounded border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out">
<svg
xmlns="http://www.w3.org/2000/svg"
<button
id="back-to-top"
class="relative group w-fit flex pl-8 pr-3 py-1.5 flex-nowrap rounded border border-black/15 dark:border-white/20 hover:bg-black/5 dark:hover:bg-white/5 hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
class="absolute top-1/2 left-2 -translate-y-1/2 size-4 stroke-2 fill-none stroke-current rotate-90">
<line x1="5" y1="12" x2="19" y2="12" class="translate-x-2 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out" />
<polyline points="12 5 5 12 12 19" class="translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out" />
class="absolute top-1/2 left-2 -translate-y-1/2 size-4 stroke-2 fill-none stroke-current rotate-90"
>
<line
x1="5"
y1="12"
x2="19"
y2="12"
class="translate-x-2 group-hover:translate-x-0 scale-x-0 group-hover:scale-x-100 transition-transform duration-300 ease-in-out"
></line>
<polyline
points="12 5 5 12 12 19"
class="translate-x-1 group-hover:translate-x-0 transition-transform duration-300 ease-in-out"
></polyline>
</svg>
<div class="text-sm">
Back to top
</div>
</button>
<div class="text-sm">Back to top</div>
</button>
3 changes: 2 additions & 1 deletion src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import BackToTop from "@components/BackToTop.astro";
</div>
<div class="flex justify-between items-center">
<div>
&copy; 2024 {`|`} {SITE.NAME}
&copy; 2024 {`|`}
{SITE.NAME}
</div>
<div class="flex flex-wrap gap-1 items-center">
<button
Expand Down
Loading

0 comments on commit 4aa33ad

Please sign in to comment.