'use client';

import React, {FC} from 'react';

import {IButton} from './button.type';
import {ButtonStyle as S} from './styles/button.style';

/**
 * ButtonComponent is a reusable React component that renders a button element with customizable styles and behaviors.
 * @version 0.0.3
 * @author Ali M. Sadeghi
 */
export const ButtonComponent: FC<IButton> = (props) => {
    const {isLoading, loadingContent} = props;

    if (isLoading)
        return (
            <S.Button dir='auto' {...props} disabled>
                {loadingContent || '...'}
            </S.Button>
        );

    return <S.Button dir='auto' {...props} />;
};
