-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/GU-99/grow-up-fe into fe…
…ature/#69-user-setting-ui
- Loading branch information
Showing
16 changed files
with
1,517 additions
and
75 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 |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import React from 'react'; | ||
import Markdown from 'react-markdown'; | ||
import remarkGfm from 'remark-gfm'; | ||
import rehypeRaw from 'rehype-raw'; | ||
import type { Components } from 'react-markdown'; | ||
|
||
type CustomMarkdownProps = { | ||
markdown: string; | ||
}; | ||
|
||
const component: Partial<Components> = { | ||
h1(props) { | ||
const { children } = props; | ||
return ( | ||
<> | ||
<h1 className="text-3xl">{children}</h1> | ||
<hr className="my-3" /> | ||
</> | ||
); | ||
}, | ||
h2(props) { | ||
const { children } = props; | ||
return <h2 className="mb-3 text-2xl">{children}</h2>; | ||
}, | ||
h3(props) { | ||
const { children } = props; | ||
return <h3 className="mb-3 text-xl">{children}</h3>; | ||
}, | ||
h4(props) { | ||
const { children } = props; | ||
return <h3 className="mb-3 text-lg">{children}</h3>; | ||
}, | ||
h5(props) { | ||
const { children } = props; | ||
return <h3 className="mb-3 text-base">{children}</h3>; | ||
}, | ||
h6(props) { | ||
const { children } = props; | ||
return <h3 className="mb-3 text-sm">{children}</h3>; | ||
}, | ||
hr() { | ||
return <hr className="my-5" />; | ||
}, | ||
a(props) { | ||
const { href, children } = props; | ||
return ( | ||
<a href={href} className="text-cyan-700"> | ||
{children} | ||
</a> | ||
); | ||
}, | ||
img(props) { | ||
const { src, alt } = props; | ||
return <img src={src} alt={alt} className="m-auto" />; | ||
}, | ||
blockquote(props) { | ||
const { children } = props; | ||
return <blockquote className="border-l-[3px] border-[#20C997] bg-[#F8F9FA] p-4">{children}</blockquote>; | ||
}, | ||
table(props) { | ||
const { children } = props; | ||
return <table className="border-collapse overflow-hidden rounded-md shadow-md">{children}</table>; | ||
}, | ||
th(props) { | ||
const { children, style } = props; | ||
return ( | ||
<th style={style} className="bg-[#4CAF50] p-5 font-bold uppercase text-white"> | ||
{children} | ||
</th> | ||
); | ||
}, | ||
td(props) { | ||
const { children, style } = props; | ||
return ( | ||
<td style={style} className="last:border-b-none border-b border-[#dddddd] p-5"> | ||
{children} | ||
</td> | ||
); | ||
}, | ||
tr(props) { | ||
const { children, style } = props; | ||
return ( | ||
<tr style={style} className="border-b border-[#dddddd] transition duration-300 even:bg-[#f4f4f4]"> | ||
{children} | ||
</tr> | ||
); | ||
}, | ||
ol(props) { | ||
const { children } = props; | ||
const timeKey = Date.now(); | ||
return ( | ||
<ol key={timeKey} className="ml-10 list-decimal"> | ||
{children} | ||
</ol> | ||
); | ||
}, | ||
ul(props) { | ||
const { children } = props; | ||
const timeKey = Date.now(); | ||
return ( | ||
<ul key={timeKey} className="ml-10 list-disc"> | ||
{children} | ||
</ul> | ||
); | ||
}, | ||
section(props) { | ||
const { children, className } = props; | ||
|
||
if (className === 'footnotes') { | ||
const newChildren = React.Children.toArray(children).slice(2) as React.ReactElement[]; | ||
return ( | ||
<section className={`${className} mt-10 border-t border-[#ddd] bg-[#f9f9f9] p-5`}> | ||
<h3 className="mb-2 font-bold">각주 모음</h3> | ||
{newChildren} | ||
</section> | ||
); | ||
} | ||
return <section className={className}>{children}</section>; | ||
}, | ||
code(props) { | ||
const { children, className } = props; | ||
return <code className={`${className} rounded-sm border-none bg-[#E9ECEF] px-2`}>{children}</code>; | ||
}, | ||
}; | ||
|
||
export default function CustomMarkdown({ markdown }: CustomMarkdownProps) { | ||
return ( | ||
<section className="rounded-md border border-input p-10 text-sm"> | ||
<Markdown components={component} remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}> | ||
{markdown} | ||
</Markdown> | ||
</section> | ||
); | ||
} |
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,38 @@ | ||
import { TbChess, TbChessKnight, TbChessQueen } from 'react-icons/tb'; | ||
import { Role } from '@/types/RoleType'; | ||
|
||
type RoleIconProps = { | ||
roleName: Role['roleName']; | ||
}; | ||
|
||
function getRoleIcon(roleName: Role['roleName']) { | ||
switch (roleName) { | ||
case 'HEAD': | ||
case 'ADMIN': | ||
return <TbChessQueen />; | ||
case 'LEADER': | ||
return <TbChessKnight />; | ||
case 'MATE': | ||
case 'ASSIGNEE': | ||
return <TbChess />; | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
export default function RoleIcon({ roleName }: RoleIconProps) { | ||
return ( | ||
<div className="group relative cursor-help"> | ||
{getRoleIcon(roleName)} | ||
{/* prettier-ignore */} | ||
<h4 className=" | ||
invisible absolute bottom-full left-1/2 -translate-x-1/2 select-none rounded-md bg-black/50 px-5 | ||
my-2 text-center text-xs text-white transition-opacity duration-700 group-hover:visible | ||
after:content[''] after:absolute after:top-full after:left-1/2 after:border-4 after:-ml-2 | ||
after:border-t-black/50 after:border-b-transparent after:border-x-transparent | ||
"> | ||
{roleName} | ||
</h4> | ||
</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
Oops, something went wrong.