70 lines
2.3 KiB
JavaScript
70 lines
2.3 KiB
JavaScript
import React from 'react';
|
|
import { Button, ConfigProvider } from 'antd';
|
|
import { ArrowLeftOutlined } from '@ant-design/icons';
|
|
|
|
const FormActions = ({
|
|
currentStep,
|
|
onPreviousStep,
|
|
onNextStep,
|
|
onSave,
|
|
onCancel,
|
|
confirmLoading,
|
|
isEditMode = false,
|
|
showCancelButton = true
|
|
}) => {
|
|
return (
|
|
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8 }}>
|
|
<ConfigProvider
|
|
theme={{
|
|
token: { colorBgContainer: '#E9F6EF' },
|
|
components: {
|
|
Button: {
|
|
defaultBg: 'white',
|
|
defaultColor: '#23A55A',
|
|
defaultBorderColor: '#23A55A',
|
|
defaultHoverColor: '#23A55A',
|
|
defaultHoverBorderColor: '#23A55A',
|
|
},
|
|
},
|
|
}}
|
|
>
|
|
{showCancelButton && (
|
|
<Button onClick={onCancel}>Batal</Button>
|
|
)}
|
|
{currentStep > 0 && (
|
|
<Button onClick={onPreviousStep} style={{ marginRight: 8 }}>
|
|
Kembali
|
|
</Button>
|
|
)}
|
|
</ConfigProvider>
|
|
|
|
<ConfigProvider
|
|
theme={{
|
|
components: {
|
|
Button: {
|
|
defaultBg: '#23a55a',
|
|
defaultColor: '#FFFFFF',
|
|
defaultBorderColor: '#23a55a',
|
|
defaultHoverBg: '#209652',
|
|
defaultHoverColor: '#FFFFFF',
|
|
defaultHoverBorderColor: '#23a55a',
|
|
},
|
|
},
|
|
}}
|
|
>
|
|
{currentStep < 1 && (
|
|
<Button loading={confirmLoading} onClick={onNextStep}>
|
|
Lanjut
|
|
</Button>
|
|
)}
|
|
{currentStep === 1 && (
|
|
<Button loading={confirmLoading} onClick={onSave}>
|
|
{isEditMode ? 'Update' : 'Simpan'}
|
|
</Button>
|
|
)}
|
|
</ConfigProvider>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default FormActions; |