Skip to content

Commit 258b657

Browse files
committed
standardize components further, theme adjustments
1 parent 93f2ae5 commit 258b657

File tree

6 files changed

+64
-42
lines changed

6 files changed

+64
-42
lines changed

src/components/home/ProjectCard.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
77
import Image from "next/image";
88
import LinkButton from "@/components/shared/LinkButton";
9+
import TextPill from "../shared/TextPill";
910

1011
interface ProjectCardProps {
1112
project: Project;
@@ -22,9 +23,8 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project, onViewMore }) => {
2223
: description;
2324

2425
return (
25-
// TODO: fix color
2626
// TODO: fix strange behavior in desktop safari
27-
<div className="break-inside-avoid bg-background dark:bg-slate-900 text-foreground mb-6 sm:mb-8 rounded-lg shadow-lg p-6 flex flex-col max-w-sm transform transition-transform hover:scale-105 hover:shadow-2xl">
27+
<div className="break-inside-avoid bg-foreground dark:bg-slate-900 dark:text-foreground mb-6 sm:mb-8 rounded-lg dark:shadow-lg shadow-xl p-6 flex flex-col max-w-sm transform transition-transform hover:scale-105 hover:shadow-2xl">
2828
{image && (
2929
<Image
3030
src={image}
@@ -33,7 +33,11 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project, onViewMore }) => {
3333
/>
3434
)}
3535
<h3 className="text-2xl font-semibold">{title}</h3>
36-
{subtitle && <h4 className="text-sm text-gray-400 mb-2">{subtitle}</h4>}
36+
{subtitle && (
37+
<h4 className="text-sm text-gray-500 dark:text-gray-400 mb-2">
38+
{subtitle}
39+
</h4>
40+
)}
3741
<p className="text-sm mb-4">
3842
{truncatedDescription}
3943
{isLongDescription && (
@@ -67,12 +71,7 @@ const ProjectCard: React.FC<ProjectCardProps> = ({ project, onViewMore }) => {
6771
)}
6872
<div className="flex flex-wrap gap-2 mt-auto">
6973
{tags.map((tag, i) => (
70-
<span
71-
key={i}
72-
className="bg-slate-800 border-slate-700 dark:bg-slate-900 dark:border-slate-800 border text-blue-700 text-xs font-medium px-2 py-1 rounded-full"
73-
>
74-
{tag}
75-
</span>
74+
<TextPill key={i} text={tag} />
7675
))}
7776
</div>
7877
</div>

src/components/home/ProjectModal.tsx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { Fragment } from "react";
1212
import Image from "next/image";
1313
import LinkButton from "@/components/shared/LinkButton";
14+
import TextPill from "@/components/shared/TextPill";
1415

1516
interface ProjectModalProps {
1617
project: Project;
@@ -45,30 +46,31 @@ const ProjectModal: React.FC<ProjectModalProps> = ({ project, onClose }) => {
4546
leaveFrom="opacity-100 scale-100"
4647
leaveTo="opacity-0 scale-95"
4748
>
48-
<DialogPanel className="bg-white rounded-lg shadow-xl max-w-2xl w-full p-6 relative">
49+
<DialogPanel className="bg-foreground dark:bg-slate-900 dark:text-foreground rounded-lg shadow-xl max-w-2xl w-full p-6 relative">
4950
<button
5051
onClick={onClose}
5152
className="absolute top-4 right-4 text-gray-500 hover:text-gray-800"
5253
>
5354
<FontAwesomeIcon icon={faTimes} className="fa-lg" />
5455
</button>
55-
<Image
56-
src={image}
57-
alt={title}
58-
className="rounded-lg w-full mt-6 mb-4 object-cover h-60"
59-
/>
60-
<DialogTitle
61-
as="h3"
62-
className="text-3xl font-bold text-gray-800 mb-2"
63-
>
56+
{image && (
57+
<Image
58+
src={image}
59+
alt={title}
60+
className="rounded-lg w-full mt-6 mb-4 object-cover h-60"
61+
/>
62+
)}
63+
<DialogTitle as="h3" className="text-3xl font-bold mb-2">
6464
{title}
6565
</DialogTitle>
6666
{subtitle && (
67-
<h4 className="text-sm text-gray-500 mb-4">{subtitle}</h4>
67+
<h4 className="text-sm text-gray-600 dark:text-gray-400 mb-4">
68+
{subtitle}
69+
</h4>
6870
)}
69-
<p className="text-gray-600 text-sm">{description}</p>
71+
<p className="text-sm pr-10 text-justify">{description}</p>
7072
{links && (
71-
<div className="flex flex-wrap gap-2 mt-4">
73+
<div className="flex flex-wrap gap-2 mt-6">
7274
{links.map((link, i) => (
7375
<LinkButton
7476
key={i}
@@ -82,12 +84,7 @@ const ProjectModal: React.FC<ProjectModalProps> = ({ project, onClose }) => {
8284
)}
8385
<div className="flex flex-wrap gap-2 mt-4">
8486
{tags.map((tag, i) => (
85-
<span
86-
key={i}
87-
className="bg-blue-100 text-blue-700 text-xs font-medium px-2 py-1 rounded-full"
88-
>
89-
{tag}
90-
</span>
87+
<TextPill key={i} text={tag} />
9188
))}
9289
</div>
9390
</DialogPanel>

src/components/shared/Button.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from "react";
22

33
export interface ButtonProps {
4-
text: string;
4+
text: string | React.ReactNode;
55
onClick?: () => void;
66
variant?: "primary" | "secondary" | "danger";
77
type?: "button" | "submit" | "reset";
8+
className?: string;
89
disabled?: boolean;
910
}
1011

@@ -14,12 +15,14 @@ const Button: React.FC<ButtonProps> = ({
1415
variant = "primary",
1516
type = "button",
1617
disabled = false,
18+
className,
1719
}) => {
18-
const baseStyles =
19-
"px-4 py-2 font-semibold text-sm rounded focus:outline-none focus:ring";
20+
const baseStyles = `inline-flex items-center px-4 py-2 font-semibold text-sm rounded focus:outline-none focus:ring transition-all ease-in-out duration-200 ${className}`;
2021
const variants = {
21-
primary: "bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-300",
22-
secondary: "bg-gray-200 text-black hover:bg-gray-300 focus:ring-gray-300",
22+
primary:
23+
"bg-background text-foreground dark:text-white hover:bg-foreground hover:text-background focus:ring-blue-300",
24+
secondary:
25+
"border border-background dark:bg-gray-200 text-black hover:bg-gray-300 focus:ring-gray-300",
2326
danger: "bg-red-500 text-white hover:bg-red-600 focus:ring-red-300",
2427
};
2528

src/components/shared/LinkButton.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ const LinkButton: React.FC<LinkButtonProps> = ({
1818
iconPosition = "left",
1919
}) => {
2020
const baseStyles =
21-
"inline-flex items-center px-4 py-2 font-semibold text-sm rounded focus:outline-none focus:ring transition-all";
21+
"inline-flex items-center px-4 py-2 font-semibold text-sm rounded focus:outline-none focus:ring transition-all ease-in-out duration-200";
2222
const variants = {
23-
primary: "bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-300",
24-
secondary: "bg-gray-200 text-black hover:bg-gray-300 focus:ring-gray-300",
23+
primary:
24+
"bg-background text-foreground dark:text-white hover:bg-foreground hover:text-background focus:ring-blue-300",
25+
secondary:
26+
"border border-background dark:bg-gray-200 text-black hover:bg-gray-300 focus:ring-gray-300",
2527
danger: "bg-red-500 text-white hover:bg-red-600 focus:ring-red-300",
2628
};
2729

src/components/shared/ScrollToBottom.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState, useEffect, useRef } from "react";
22
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
33
import { faArrowDown } from "@fortawesome/free-solid-svg-icons";
4+
import Button from "@/components/shared/Button";
45

56
interface ScrollToBottomProps {
67
children: React.ReactNode;
@@ -51,13 +52,19 @@ const ScrollToBottom: React.FC<ScrollToBottomProps> = ({
5152
<div ref={contentRef} className="relative">
5253
{children}
5354
{showButton && (
54-
<button
55-
className="fixed bottom-4 right-4 bg-blue-500 text-white py-2 px-4 rounded shadow-md hover:bg-blue-600 focus:outline-none"
55+
<Button
56+
className="fixed bottom-4 right-4"
5657
onClick={scrollToBottom}
57-
>
58-
{showIcons && <FontAwesomeIcon icon={faArrowDown} className="mr-2" />}
59-
{scrollToBottomText}
60-
</button>
58+
text={
59+
<>
60+
{showIcons && (
61+
<FontAwesomeIcon icon={faArrowDown} className="mr-2" />
62+
)}
63+
{scrollToBottomText}
64+
</>
65+
}
66+
variant="primary"
67+
/>
6168
)}
6269
</div>
6370
);

src/components/shared/TextPill.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react";
2+
3+
export interface TextPillProps {
4+
text: string;
5+
}
6+
7+
const TextPill: React.FC<TextPillProps> = ({ text }) => {
8+
const baseStyles =
9+
"text-background border-background dark:bg-slate-900 dark:border-slate-800 border dark:text-foreground text-xs font-medium px-2 py-1 rounded-md";
10+
11+
return <span className={`${baseStyles}`}>{text}</span>;
12+
};
13+
14+
export default TextPill;

0 commit comments

Comments
 (0)