Skip to content

Commit

Permalink
Feat: 글 작성 버튼 추가 (#2)
Browse files Browse the repository at this point in the history
- 사용자 편의성을 위한 글 작성 버튼 UI 구현
- 클릭 시 글 작성 페이지로 이동하도록 기능 추가
  • Loading branch information
sunglitter committed Nov 21, 2024
1 parent cb3e72a commit 4e0941c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/components/common/WriteButton.tsx
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;

0 comments on commit 4e0941c

Please sign in to comment.