-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update ProfileCard component with thumbnail, name, job title, c…
…ompany, and description props and button
- Loading branch information
1 parent
f79acc7
commit a23cd38
Showing
4 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,70 @@ | ||
"use server"; | ||
|
||
const ProfileCard = () => { | ||
return <h1>Hello World!</h1> | ||
} | ||
import { memo } from "react"; | ||
import Image from "next/image"; | ||
import { | ||
formatFullName, | ||
formatButtonVariantClassName, | ||
formatJobTitleAndCompany, | ||
} from "@/lib/utils/formatting"; | ||
import { IProfileCardProps, IButtonProps } from "./ProfileCard.types"; | ||
|
||
export default ProfileCard; | ||
const Button: React.FC<IButtonProps> = ({ | ||
type, | ||
addClassName, | ||
children, | ||
variant = "primary", | ||
...rest | ||
}) => { | ||
const BASE_BUTTON_CLASSES = | ||
"w-fit flex flex-row items-center text-base gap-2 p-px"; | ||
|
||
return ( | ||
<button | ||
{...rest} | ||
type={type} | ||
disabled={variant === "disabled"} | ||
className={formatButtonVariantClassName( | ||
variant, | ||
BASE_BUTTON_CLASSES, | ||
addClassName | ||
)} | ||
> | ||
<span>{children}</span> | ||
</button> | ||
); | ||
}; | ||
|
||
const ProfileCard: React.FC<IProfileCardProps> = memo( | ||
({ thumbnail, firstName, lastName, jobTitle, company, description }) => ( | ||
<article className="flex flex-col items-center w-[340px] h-auto bg-white rounded-md drop-shadow-md font-noto-sans px-4 py-6 gap-10"> | ||
<header className="flex flex-col items-center gap-6 justify-between"> | ||
<Image | ||
src={thumbnail} | ||
alt="The profile picture of the user" | ||
width={64} | ||
height={64} | ||
priority | ||
/> | ||
<div className="flex flex-col items-center gap-px"> | ||
<h1 className="text-xl text-neutral-900 font-medium"> | ||
{formatFullName(firstName, lastName)} | ||
</h1> | ||
<h2 className="text-sm text-neutral-600 font-light"> | ||
{formatJobTitleAndCompany(jobTitle, company)} | ||
</h2> | ||
</div> | ||
<p className="text-base text-neutral-600 font-normal text-center"> | ||
{description} | ||
</p> | ||
</header> | ||
<Button type="button" variant="primary"> | ||
Contact me | ||
</Button> | ||
</article> | ||
) | ||
); | ||
|
||
ProfileCard.displayName = "ProfileCard"; | ||
|
||
export default ProfileCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IButtonProps } from "@/components/BlogCard/BlogCard.types"; | ||
|
||
interface IProfileCardProps { | ||
thumbnail: string; | ||
firstName: string; | ||
lastName: string; | ||
jobTitle: string; | ||
company: string; | ||
description: string; | ||
} | ||
|
||
export type { IProfileCardProps, IButtonProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters