Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions components/LinkBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
interface LinkBarProps {
link: string;
onClick?: () => void;
}

/**
* 링크 주소를 표시하는 컴포넌트
* @param link 링크 주소
* @param onClick 링크 클릭 시 실행할 함수
*/
export default function LinkBar({ link, onClick }: LinkBarProps) {
return (
<div
onClick={onClick}
className="flex cursor-pointer items-center gap-[5px] rounded-custom bg-green-100 px-[10px] py-[3px] mo:py-1"
>
<img
src="/icon-link.svg"
alt="링크 아이콘"
className="h-5 w-5 mo:h-4 mo:w-4"
/>
<p className="text-14 text-green-200 mo:text-12">{link}</p>
</div>
);
}
12 changes: 6 additions & 6 deletions pages/test/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import LinkBar from '@/components/LinkBar';

export default function Test() {
const commonCellClass = 'border-r border-gray-300';
const commonRowClass = 'flex flex-wrap items-end gap-2';
Expand All @@ -13,12 +15,10 @@ export default function Test() {
</thead>
<tbody>
<tr>
<td className={commonCellClass}>컴포넌트명 입력</td>
<td className={commonRowClass}>{/* 컴포넌트를 추가해주세요 */}</td>
</tr>
<tr>
<td className={commonCellClass}>컴포넌트명 입력</td>
<td className={commonRowClass}>{/* 컴포넌트를 추가해주세요 */}</td>
<td className={commonCellClass}>LinkBar</td>
<td className={commonRowClass}>
<LinkBar link="https://www.google.com" />
</td>
</tr>
</tbody>
</table>
Expand Down
3 changes: 3 additions & 0 deletions public/icon-link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading