Skip to content

Commit 6576159

Browse files
load1n9iuioiua
andauthored
feat: dark mode (#219)
* feat(WIP): dark mode * feat: dark mode * feat: hover styles + fmt * Update utils/constants.ts Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com> * tweaks --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
1 parent 4eabda6 commit 6576159

File tree

7 files changed

+22
-15
lines changed

7 files changed

+22
-15
lines changed

components/ItemSummary.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,26 @@ export interface ItemSummaryProps {
1111

1212
export default function ItemSummary(props: ItemSummaryProps) {
1313
return (
14-
<div class="py-2 flex gap-2 text-gray-500">
14+
<div class="py-2 flex gap-2">
1515
<VoteButton
1616
item={props.item}
1717
isVoted={props.isVoted}
1818
/>
1919
<div>
2020
<span class="mr-2">
21-
<a class="text-black hover:underline" href={`/item/${props.item.id}`}>
21+
<a
22+
class="hover:underline"
23+
href={`/item/${props.item.id}`}
24+
>
2225
{props.item.title}
2326
</a>
2427
</span>
2528
<span>
26-
<a class="hover:underline" href={props.item.url} target="_blank">
29+
<a
30+
class="hover:underline text-gray-500"
31+
href={props.item.url}
32+
target="_blank"
33+
>
2734
{new URL(props.item.url).host}
2835
</a>
2936
</span>

components/Layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function Footer(props: JSX.HTMLAttributes<HTMLElement>) {
7070
{...props}
7171
class={`flex flex-col md:flex-row p-4 justify-between gap-y-4 ${SITE_WIDTH_STYLES} ${
7272
props.class ?? ""
73-
}`}
73+
} `}
7474
>
7575
<span>
7676
<strong>{SITE_NAME}</strong>
@@ -133,7 +133,7 @@ export default function Layout(props: LayoutProps) {
133133
];
134134

135135
return (
136-
<div class="flex flex-col min-h-screen">
136+
<div class="flex flex-col min-h-screen dark:bg-gray-900 dark:text-white">
137137
<Notice />
138138
<Header>
139139
<Nav items={headerNavItems} />

routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function PageSelector(props: { currentPage: number; lastPage: number }) {
6060
<form class="inline-flex items-center gap-x-2">
6161
<input
6262
id="current_page"
63-
class={`bg-white rounded rounded-lg outline-none w-full border-1 border-gray-300 hover:border-black transition duration-300 disabled:(opacity-50 cursor-not-allowed) rounded-md px-2 py-1`}
63+
class={`bg-transparent rounded rounded-lg outline-none w-full border-1 border-gray-500 hover:border-black transition duration-300 disabled:(opacity-50 cursor-not-allowed) rounded-md px-2 py-1 dark:(hover:border-white)`}
6464
type="number"
6565
name="page"
6666
min="1"

routes/item/[id].tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,8 @@ export default function ItemPage(props: PageProps<ItemPageData>) {
114114
<button type="submit" class={BUTTON_STYLES}>Comment</button>
115115
</form>
116116
<div>
117-
<h2>
118-
<strong>
119-
{pluralize(props.data.comments.length, "comment")}
120-
</strong>
117+
<h2 class="font-bold">
118+
{pluralize(props.data.comments.length, "comment")}
121119
</h2>
122120
{props.data.comments.sort((a, b) =>
123121
b.createdAt.getTime() - a.createdAt.getTime()

routes/pricing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ interface PricingCardProps {
4444

4545
function PricingCard(props: PricingCardProps) {
4646
return (
47-
<div class="flex-1 space-y-4 p-4 ring-1 ring-gray-300 rounded-xl text-center">
47+
<div class="flex-1 space-y-4 p-4 ring-1 ring-gray-300 rounded-xl text-center dark:bg-gray-700">
4848
<div>
4949
<h3 class="text-2xl font-bold">
5050
{props.name}

routes/submit.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ export default function SubmitPage(props: PageProps<State>) {
7676
<Head title="Submit" href={props.url.href} />
7777
<Layout session={props.data.sessionId}>
7878
<div class="flex-1 flex flex-col justify-center max-w-sm mx-auto w-full space-y-8">
79-
<h1 class="text-center text-2xl font-bold">Share your project</h1>
79+
<h1 class="text-center text-2xl font-bold">
80+
Share your project
81+
</h1>
8082
<Form />
8183
</div>
8284
</Layout>

utils/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export const REDIRECT_PATH_AFTER_LOGIN = "/";
66
/**
77
* These are base styles for some elements. This approach is chosen as it avoids more complex alternatives:
88
* 1. Writing custom classes in Tailwind CSS (see https://tailwindcss.com/docs/reusing-styles#compared-to-css-abstractions)
9-
* 2. Writing custom components which offer no additional funtionality beyond styling
9+
* 2. Writing custom components which offer no additional functionality beyond styling
1010
*/
1111
export const BUTTON_STYLES =
12-
"px-4 py-2 bg-pink-700 hover:bg-white text-white hover:text-pink-700 text-lg rounded-lg border-2 border-pink-700 transition duration-300 disabled:(opacity-50 cursor-not-allowed)";
12+
"px-4 py-2 bg-pink-700 text-white text-lg rounded-lg border-2 border-pink-700 transition duration-300 disabled:(opacity-50 cursor-not-allowed) hover:(bg-transparent text-pink-700)";
1313
export const INPUT_STYLES =
14-
"px-4 py-2 bg-white rounded rounded-lg outline-none w-full border-1 border-gray-300 hover:border-black transition duration-300 disabled:(opacity-50 cursor-not-allowed)";
14+
"px-4 py-2 bg-transparent rounded rounded-lg outline-none w-full border-1 border-gray-500 hover:border-black transition duration-300 disabled:(opacity-50 cursor-not-allowed) dark:(hover:border-white)";
1515
export const NOTICE_STYLES =
1616
"px-4 py-2 rounded-lg bg-yellow-100 text-yellow-700";
1717
export const SITE_WIDTH_STYLES = "mx-auto max-w-7xl w-full";

0 commit comments

Comments
 (0)