forked from YJU-OKURA/project_minori-next-deployment-repo
-
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 : Create a Card Component Layout
- Make duplicate code into components for easier reuse - Add interface files to apply the required types to each component Related issue: YJU-OKURA#59
- Loading branch information
Showing
5 changed files
with
104 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use client'; | ||
import Image from 'next/image'; | ||
import {CardProps} from '@/src/interfaces/group/cardProps'; | ||
import icons from '@/public/svgs/group'; | ||
|
||
const Card = ({ | ||
ImageSrc, | ||
GroupName, | ||
GroupContent, | ||
FavoriteChecked, | ||
}: CardProps) => { | ||
return ( | ||
<div className="border rounded-lg w-80 h-72 border-gray-300 mr-10 mb-10 hover:shadow-md active:bg-neutral-50 focus:ring focus:ring-gray-400 transform hover:scale-105 transition duration-200 ease-in-out"> | ||
<div className="flex justify-center items-center mt-2"> | ||
<div className="w-72 h-44 relative overflow-hidden"> | ||
<Image | ||
src={ImageSrc} | ||
alt={'Card Image'} | ||
priority={true} | ||
layout="fill" | ||
objectFit="contain" | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex place-content-between ms-4 mt-2"> | ||
<h3 className="font-bold text-lg">{GroupName}</h3> | ||
{FavoriteChecked ? ( | ||
<Image | ||
src={icons.favorite} | ||
alt="favoriteChecked" | ||
width={24} | ||
height={24} | ||
className="items-center me-2" | ||
/> | ||
) : ( | ||
<Image | ||
src={icons.noneFavorite} | ||
alt="noneFavoriteChecked" | ||
width={24} | ||
height={24} | ||
className="items-center me-2" | ||
/> | ||
)} | ||
</div> | ||
<p className="text-base ms-4 mt-2 me-2 overflow-hidden overflow-ellipsis whitespace-nowrap"> | ||
{GroupContent} | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Card; |
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,33 @@ | ||
'use client'; | ||
|
||
import Image from 'next/image'; | ||
import {InvitationProps} from '@/src/interfaces/group/invitationProps'; | ||
|
||
const Invitation = ({ImageSrc, GroupName, ManagerName}: InvitationProps) => { | ||
return ( | ||
<div className="border rounded-lg w-80 h-72 overflow-hidden border-gray-300 mr-10 mb-10 hover:shadow-lg active:bg-neutral-50 focus:ring focus:ring-gray-400 transform hover:scale-105 transition duration-200 ease-in-out"> | ||
<div className="flex justify-center items-center"> | ||
<div className="w-72 h-44 relative overflow-hidden"> | ||
<Image | ||
src={ImageSrc} | ||
alt={'Card Image'} | ||
priority={true} | ||
layout="fill" | ||
objectFit="contain" | ||
/> | ||
</div> | ||
</div> | ||
<div className="p-4"> | ||
<h3 className="font-semibold text-lg text-violet-500 mb-2"> | ||
{GroupName} | ||
</h3> | ||
<p className="text-base text-gray-700"> | ||
Invited by{' '} | ||
<span className="font-semibold text-rose-500">{ManagerName}</span> | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Invitation; |
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,4 @@ | ||
import Card from './Card'; | ||
import Invitation from './Invitation'; | ||
|
||
export {Card, Invitation}; |
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,8 @@ | ||
interface CardProps { | ||
ImageSrc: string; | ||
GroupName: string; | ||
GroupContent: string; | ||
FavoriteChecked: boolean; | ||
} | ||
|
||
export type {CardProps}; |
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,7 @@ | ||
interface InvitationProps { | ||
ImageSrc: string; | ||
GroupName: string; | ||
ManagerName: string; | ||
} | ||
|
||
export type {InvitationProps}; |