-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from keemsebin/feature#136
동아리 피드 전체조회/개별조회
- Loading branch information
Showing
25 changed files
with
705 additions
and
175 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,103 @@ | ||
import Image from 'next/image'; | ||
import { parseImgUrl } from '@/utils/parse'; | ||
|
||
export type ClubInfoDetail = { | ||
introduceImageUrls: string[]; | ||
introduction: string; | ||
activity: string; | ||
ideal: string; | ||
}; | ||
|
||
export default function ClubInfo({ | ||
introduceImageUrls, | ||
introduction, | ||
activity, | ||
ideal, | ||
}: ClubInfoDetail) { | ||
function checkUrl(strUrl: string) { | ||
const expUrl = /https?:\/\/[^\s"]/; | ||
return expUrl.test(strUrl); | ||
} | ||
function parseUrl(line: string) { | ||
if (checkUrl(line)) { | ||
const words = line.split(' '); | ||
const elements = words.map((word, index) => { | ||
return checkUrl(word) ? ( | ||
<a | ||
key={`urlWord${index}`} | ||
href={word} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="truncate whitespace-pre-line pr-1 underline underline-offset-1" | ||
> | ||
{word} | ||
</a> | ||
) : ( | ||
<span key={`urlWord${index}`} className="pr-1"> | ||
{word} | ||
</span> | ||
); | ||
}); | ||
return <div className="flex">{elements}</div>; | ||
} else { | ||
return <span>{line}</span>; | ||
} | ||
} | ||
|
||
const parsedImg = introduceImageUrls[0] && parseImgUrl(introduceImageUrls[0]); | ||
|
||
return ( | ||
<main className="w-full lg:w-[70%]"> | ||
<section className="mt-6 md:mt-8"> | ||
<div | ||
className={`${ | ||
introduceImageUrls.length === 0 && `hidden` | ||
} mt-6 md:mt-8`} | ||
> | ||
<div className="my-2 text-lg font-bold md:text-xl"> | ||
동아리 소개 이미지 | ||
</div> | ||
{parsedImg && ( | ||
<Image | ||
src={parsedImg} | ||
width={1000} | ||
height={500} | ||
priority | ||
alt="동아리 소개 사진" | ||
className={`${ | ||
introduceImageUrls.length === 0 && `hidden` | ||
} max-h-[50vh] rounded-2xl object-scale-down`} | ||
/> | ||
)} | ||
</div> | ||
|
||
<div className="mt-6 text-lg font-bold md:mt-8 md:text-xl"> | ||
우리 동아리를 소개할게요 | ||
</div> | ||
<div className="mt-1 bg-white text-base font-medium text-gray-500 md:mt-2 md:text-lg"> | ||
{introduction?.split('\n').map((line: string, index: number) => ( | ||
<p key={index}>{parseUrl(line)}</p> | ||
))} | ||
</div> | ||
</section> | ||
<section className="mt-6 md:mt-8"> | ||
<div className="text-lg font-bold md:text-xl">이런 활동을 해요</div> | ||
<ul className="ml-5 mt-1 list-disc text-base font-medium text-gray-500 md:mt-1.5 md:text-lg"> | ||
{activity?.split('\n').map((line: string, index: number) => ( | ||
<li key={index}>{line}</li> | ||
))} | ||
</ul> | ||
</section> | ||
<section className="mt-6 md:mt-8"> | ||
<div className="text-lg font-bold md:text-xl"> | ||
이런 분과 함께하고 싶어요 | ||
</div> | ||
<ul className="ml-5 mt-1 list-disc text-base font-medium text-gray-500 md:mt-1.5 md:text-lg"> | ||
{ideal?.split('\n').map((line: string, index: number) => ( | ||
<li key={index}>{line}</li> | ||
))} | ||
</ul> | ||
</section> | ||
</main> | ||
); | ||
} |
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
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,3 @@ | ||
export default function Skeleton() { | ||
return <div className="h-full w-full animate-pulse bg-gray-300"></div>; | ||
} |
Oops, something went wrong.