Skip to content

Commit bd78baa

Browse files
authored
Merge pull request #27 from codeitFE11-part3-team7/feature/#26_Link-컴포넌트
#26 link 컴포넌트
2 parents 5503f75 + 8c66068 commit bd78baa

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

components/LinkBar.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
interface LinkBarProps {
2+
link: string;
3+
onClick?: () => void;
4+
}
5+
6+
/**
7+
* 링크 주소를 표시하는 컴포넌트
8+
* @param link 링크 주소
9+
* @param onClick 링크 클릭 시 실행할 함수
10+
*/
11+
export default function LinkBar({ link, onClick }: LinkBarProps) {
12+
return (
13+
<button
14+
type="button"
15+
onClick={onClick}
16+
className="flex cursor-pointer items-center gap-[5px] rounded-custom bg-green-100 px-[10px] py-[3px] mo:py-1"
17+
>
18+
<img
19+
src="icon/icon-link.svg"
20+
alt="링크 아이콘"
21+
className="h-5 w-5 mo:h-4 mo:w-4"
22+
/>
23+
<p className="text-14 text-green-200 mo:text-12">{link}</p>
24+
</button>
25+
);
26+
}

pages/test/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Button from '@/components/Button';
2+
import LinkBar from '@/components/LinkBar';
23

34
export default function Test() {
45
const commonCellClass = 'border-r border-gray-300';
@@ -14,7 +15,7 @@ export default function Test() {
1415
</tr>
1516
</thead>
1617
<tbody>
17-
<tr>
18+
<tr className="border-b border-gray-300">
1819
<td className={commonCellClass}>Button</td>
1920
<td className={commonRowClass}>
2021
<Button size="small">small</Button>
@@ -33,8 +34,10 @@ export default function Test() {
3334
</td>
3435
</tr>
3536
<tr>
36-
<td className={commonCellClass}>컴포넌트명 입력</td>
37-
<td className={commonRowClass}>{/* 컴포넌트를 추가해주세요 */}</td>
37+
<td className={commonCellClass}>LinkBar</td>
38+
<td className={commonRowClass}>
39+
<LinkBar link="https://www.google.com" />
40+
</td>
3841
</tr>
3942
</tbody>
4043
</table>

public/icon/icon-link.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)