diff --git a/src/components/Button.tsx b/src/components/Button.tsx index fac565b..23c25b8 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,23 +1,17 @@ import styled from 'styled-components'; interface ButtonInterface { - color: string; - borderColor?: string; message: string; onClick: VoidFunction; } -const Button = ({ color, borderColor, message, onClick }: ButtonInterface) => { - return ( - - {message} - - ); +const Button = ({ message, onClick }: ButtonInterface) => { + return {message}; }; export default Button; -const ButtonWrapper = styled.div<{ $color: string; $borderColor?: string }>` +const ButtonWrapper = styled.div` display: flex; align-items: center; justify-content: center; @@ -27,9 +21,8 @@ const ButtonWrapper = styled.div<{ $color: string; $borderColor?: string }>` font-size: 1.6rem; text-align: center; - color: ${({ theme, $color }) => theme.colors[$color]}; + color: ${({ theme }) => theme.colors.white}; border-radius: 1.8rem; - border: 1px solid - ${({ theme, $borderColor }) => ($borderColor ? theme.colors[$borderColor] : 'white')}; + border: 1px solid ${({ theme }) => theme.colors.white}; `; diff --git a/src/components/DeleteButton.tsx b/src/components/DeleteButton.tsx new file mode 100644 index 0000000..4f44564 --- /dev/null +++ b/src/components/DeleteButton.tsx @@ -0,0 +1,40 @@ +import styled from 'styled-components'; +import { useDeleteUser } from '../hooks/queries/useDeleteUser'; + +interface DeleteButtonInterface { + message: string; +} + +const DeleteButton = ({ message }: DeleteButtonInterface) => { + const { deleteUser } = useDeleteUser(); + const accessToken = localStorage.getItem('ACCESS_TOKEN'); + + if (!accessToken) { + console.error('Access token is missing'); + return null; + } + + const handleDeleteUser = () => { + deleteUser(accessToken); + }; + + return {message}; +}; + +export default DeleteButton; + +const ButtonWrapper = styled.div` + display: flex; + align-items: center; + justify-content: center; + + width: 26rem; + height: 5.2rem; + + font-size: 1.6rem; + text-align: center; + color: ${({ theme }) => theme.colors.red}; + + border-radius: 1.8rem; + border: 1px solid ${({ theme }) => theme.colors.red}; +`; diff --git a/src/layouts/DeleteLayout.tsx b/src/layouts/DeleteLayout.tsx index e1a629e..9481c7f 100644 --- a/src/layouts/DeleteLayout.tsx +++ b/src/layouts/DeleteLayout.tsx @@ -1,17 +1,12 @@ import styled from 'styled-components'; import { IcFeelingLBlank, IcPcBlank, IcPcRecordream } from '../assets/svg'; -import Button from '../components/Button'; import { Outlet } from 'react-router-dom'; -import { useDeleteUser } from '../hooks/queries/useDeleteUser'; interface DeleteLayoutInterface { iconOn: boolean; - btnColor: string; - btnMessage: string; } -const DeleteLayout = ({ iconOn, btnColor, btnMessage }: DeleteLayoutInterface) => { - const { deleteUser } = useDeleteUser(); +const DeleteLayout = ({ iconOn }: DeleteLayoutInterface) => { const accessToken = localStorage.getItem('ACCESS_TOKEN'); console.log('ACCESSTOKEn', accessToken); @@ -20,10 +15,6 @@ const DeleteLayout = ({ iconOn, btnColor, btnMessage }: DeleteLayoutInterface) = return null; } - const handleDeleteUser = () => { - deleteUser(accessToken); - }; - return ( @@ -33,7 +24,6 @@ const DeleteLayout = ({ iconOn, btnColor, btnMessage }: DeleteLayoutInterface) = )} -