Refactor SecurityPrivacySettings component
Refactor the SecurityPrivacySettings component into smaller, more manageable sub-components for improved readability and maintainability. The functionality of the page remains unchanged.
This commit is contained in:
41
src/components/security/SaveSettingsButton.tsx
Normal file
41
src/components/security/SaveSettingsButton.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
type SaveSettingsButtonProps = {
|
||||
onSave?: () => void;
|
||||
};
|
||||
|
||||
const SaveSettingsButton = ({ onSave }: SaveSettingsButtonProps) => {
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
|
||||
const handleSave = () => {
|
||||
// 사용자 정의 저장 함수가 있으면 실행
|
||||
if (onSave) {
|
||||
onSave();
|
||||
}
|
||||
|
||||
// 기본 저장 동작
|
||||
toast({
|
||||
title: "보안 설정이 저장되었습니다.",
|
||||
description: "변경사항이 성공적으로 적용되었습니다.",
|
||||
});
|
||||
navigate('/settings');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="px-6">
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
className="w-full bg-neuro-income text-white hover:bg-neuro-income/90"
|
||||
>
|
||||
저장하기
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SaveSettingsButton;
|
||||
Reference in New Issue
Block a user