import React from 'react';
import {View} from '@tarojs/components';
import {Button} from '@nutui/nutui-react-taro'

interface FixedButtonProps {
  text?: string;
  onClick?: () => void;
  icon?: React.ReactNode;
  disabled?: boolean;
  background?: string;
}

function FixedButton({text, onClick, icon, disabled, background}: FixedButtonProps) {
  return (
    <>
      {/* 底部安全区域占位 */}
      <View className="h-20 w-full"></View>
      <View
        className="fixed z-50 bottom-0 left-0 right-0 bg-white border-t border-gray-200 px-4 py-3 safe-area-bottom">
        <Button
          type="primary"
          style={{
            background
          }}
          size="large"
          block
          icon={icon}
          disabled={disabled}
          className="px-6"
          onClick={onClick}>
          {text || '新增'}
        </Button>
      </View>
    </>
  )
}

export default FixedButton;
