2022-05-30 07:52:38 +03:00
|
|
|
import { Button } from 'antd';
|
|
|
|
import { HeartFilled } from '@ant-design/icons';
|
|
|
|
import { useState } from 'react';
|
2022-06-25 01:55:53 +03:00
|
|
|
import { useRecoilValue } from 'recoil';
|
2022-05-30 07:52:38 +03:00
|
|
|
import Modal from '../ui/Modal/Modal';
|
2022-06-25 01:55:53 +03:00
|
|
|
import FollowModal from '../modals/Follow/FollowModal';
|
2022-05-30 07:52:38 +03:00
|
|
|
import s from './ActionButton.module.scss';
|
2022-06-25 01:55:53 +03:00
|
|
|
import { clientConfigStateAtom } from '../stores/ClientConfigStore';
|
|
|
|
import { ClientConfig } from '../../interfaces/client-config.model';
|
2022-05-30 07:52:38 +03:00
|
|
|
|
2022-07-08 10:10:18 +03:00
|
|
|
export default function FollowButton(props: any) {
|
2022-05-30 07:52:38 +03:00
|
|
|
const [showModal, setShowModal] = useState(false);
|
2022-06-25 01:55:53 +03:00
|
|
|
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
|
|
|
|
const { name } = clientConfig;
|
2022-05-30 07:52:38 +03:00
|
|
|
|
|
|
|
const buttonClicked = () => {
|
|
|
|
setShowModal(true);
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button
|
2022-07-08 10:10:18 +03:00
|
|
|
{...props}
|
2022-05-30 07:52:38 +03:00
|
|
|
type="primary"
|
2022-07-08 10:10:18 +03:00
|
|
|
className={s.button}
|
2022-05-30 07:52:38 +03:00
|
|
|
icon={<HeartFilled />}
|
|
|
|
onClick={buttonClicked}
|
|
|
|
>
|
|
|
|
Follow
|
|
|
|
</Button>
|
2022-06-25 01:55:53 +03:00
|
|
|
<Modal title={`Follow ${name}`} visible={showModal} handleCancel={() => setShowModal(false)}>
|
|
|
|
<FollowModal handleClose={() => setShowModal(false)} />
|
|
|
|
</Modal>
|
2022-05-30 07:52:38 +03:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|