-
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.
- 사용자 편의성을 위한 글 작성 버튼 UI 구현 - 클릭 시 글 작성 페이지로 이동하도록 기능 추가
- Loading branch information
1 parent
cb3e72a
commit 4e0941c
Showing
1 changed file
with
35 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { FaPen } from 'react-icons/fa'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
interface WriteButtonProps { | ||
navigateTo?: string; // 기본 이동 경로 | ||
} | ||
|
||
const WriteButton: React.FC<WriteButtonProps> = ({ navigateTo = '/write' }) => { | ||
const navigate = useNavigate(); | ||
|
||
return ( | ||
<Button onClick={() => navigate(navigateTo)}> | ||
<FaPen /> 글 작성 | ||
</Button> | ||
); | ||
}; | ||
|
||
const Button = styled.button` | ||
padding: 8px 16px; | ||
font-size: 1rem; | ||
font-weight: bold; | ||
color: #fff; | ||
background-color: #000; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
&:hover { | ||
background-color: #333; | ||
} | ||
`; | ||
|
||
export default WriteButton; |