-
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.
Merge pull request #141 from k35o/rounded
角丸等の調整
- Loading branch information
Showing
20 changed files
with
84 additions
and
99 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 |
---|---|---|
@@ -1,69 +1,68 @@ | ||
import { Heading } from '@/components/heading'; | ||
import { TextTag } from '@/components/text-tag'; | ||
import { Route } from 'next'; | ||
import { isInternalRoute } from '@/utils/is-internal-route'; | ||
import Link from 'next/link'; | ||
import { FC } from 'react'; | ||
|
||
export const BlogCard = <T extends string>({ | ||
link, | ||
emotion, | ||
title, | ||
tags, | ||
}: { | ||
type BlogCardProps = { | ||
link: string; | ||
emotion: string; | ||
title: string; | ||
tags: [string?, string?, string?, string?, string?]; | ||
}; | ||
|
||
export const BlogCard: FC<BlogCardProps> = ({ | ||
link, | ||
emotion, | ||
title, | ||
tags, | ||
}) => { | ||
const isExternal = link.startsWith('http'); | ||
return ( | ||
<section className="h-40 rounded-md bg-white shadow-md"> | ||
{isExternal ? ( | ||
<section className="h-40 rounded-xl bg-white shadow-md"> | ||
{isInternalRoute(link) ? ( | ||
<Link href={link}> | ||
<BlogCardContent | ||
emotion={emotion} | ||
title={title} | ||
tags={tags} | ||
/> | ||
</Link> | ||
) : ( | ||
<a href={link} target="_blank" rel="noopener noreferrer"> | ||
<div className="flex gap-6 p-4"> | ||
<div className="flex h-32 w-32 shrink-0 items-center justify-center rounded-md bg-gray text-7xl"> | ||
{emotion} | ||
</div> | ||
<div className="flex w-full flex-col justify-around"> | ||
<Heading type="h3" lineClamp={3}> | ||
{title} | ||
</Heading> | ||
{tags.length > 0 && ( | ||
<div className="hidden justify-end gap-2 md:flex"> | ||
{tags.map((tag) => { | ||
if (!tag) { | ||
return null; | ||
} | ||
return <TextTag key={tag} text={tag} />; | ||
})} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
<BlogCardContent | ||
emotion={emotion} | ||
title={title} | ||
tags={tags} | ||
/> | ||
</a> | ||
) : ( | ||
<Link href={link as Route<T>}> | ||
<div className="flex gap-6 p-4"> | ||
<div className="flex h-32 w-32 shrink-0 items-center justify-center rounded-md bg-gray text-7xl"> | ||
{emotion} | ||
</div> | ||
<div className="flex w-full flex-col justify-around"> | ||
<Heading type="h3" lineClamp={3}> | ||
{title} | ||
</Heading> | ||
{tags.length > 0 && ( | ||
<div className="hidden justify-end gap-2 md:flex"> | ||
{tags.map((tag) => { | ||
if (!tag) { | ||
return null; | ||
} | ||
return <TextTag key={tag} text={tag} />; | ||
})} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</Link> | ||
)} | ||
</section> | ||
); | ||
}; | ||
|
||
export const BlogCardContent: FC<Omit<BlogCardProps, 'link'>> = ({ | ||
emotion, | ||
title, | ||
tags, | ||
}) => ( | ||
<div className="flex gap-6 p-4"> | ||
<div className="flex h-32 w-32 shrink-0 items-center justify-center rounded-lg bg-bgLight text-7xl"> | ||
{emotion} | ||
</div> | ||
<div className="flex w-full flex-col justify-around"> | ||
<Heading type="h3" lineClamp={3}> | ||
{title} | ||
</Heading> | ||
{tags.length > 0 && ( | ||
<div className="hidden justify-end gap-2 md:flex"> | ||
{tags.map((tag) => { | ||
if (!tag) { | ||
return null; | ||
} | ||
return <TextTag key={tag} text={tag} />; | ||
})} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); |
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
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
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
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
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
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
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