DocSpace-client/packages/asc-web-common/components/FloatingButton/FloatingButton.js

93 lines
2.8 KiB
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import {
StyledFloatingButton,
StyledAlertIcon,
StyledCircleWrap,
StyledCircle,
2021-03-10 17:10:09 +00:00
IconBox,
} from './StyledFloatingButton';
Merge branch 'develop' into feature/workspaces # Conflicts: # packages/asc-web-common/src/components/FilterInput/FilterInput.js # packages/asc-web-common/src/components/FilterInput/sub-components/SortComboBox.js # packages/asc-web-common/src/components/PageLayout/index.js # packages/asc-web-common/src/components/PageLayout/sub-components/article-body.js # packages/asc-web-common/src/components/PageLayout/sub-components/article-header.js # packages/asc-web-common/src/components/PageLayout/sub-components/article-main-button.js # packages/asc-web-common/src/components/PageLayout/sub-components/section-body.js # packages/asc-web-common/src/components/PageLayout/sub-components/section-header.js # packages/asc-web-common/src/components/PrivateRoute/PrivateRoute.js # products/ASC.Files/Client/package.json # products/ASC.Files/Client/src/components/Article/Body/TreeFolders.js # products/ASC.Files/Client/src/components/pages/DocEditor/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Filter/index.js # products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js # products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js # products/ASC.Files/Client/src/components/panels/SharingPanel/index.js # products/ASC.Files/Client/src/index.js # products/ASC.Files/Client/src/store/files/actions.js # products/ASC.Files/Client/yarn.lock # products/ASC.People/Client/package.json # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/ContactField.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/DateField.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/EmailField.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/RadioField.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/TextChangeField.js # products/ASC.People/Client/src/components/pages/ProfileAction/Section/Body/FormFields/TextField.js # products/ASC.People/Client/src/index.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/package.json # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/Confirm/index.js # web/ASC.Web.Client/src/components/pages/Confirm/sub-components/activateEmail.js # web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changeEmail.js # web/ASC.Web.Client/src/components/pages/Confirm/sub-components/changeOwner.js # web/ASC.Web.Client/src/helpers/confirmRoute.js # web/ASC.Web.Client/src/index.js # web/ASC.Web.Common/package.json # web/ASC.Web.Common/yarn.lock # web/ASC.Web.Components/package.json # web/ASC.Web.Components/yarn.lock # web/ASC.Web.Login/src/LoginContent.jsx # web/ASC.Web.Login/src/sub-components/register-container.js # yarn.lock
2020-12-15 15:40:27 +00:00
import ButtonUploadIcon from '../../../../public/images/button.upload.react.svg';
import ButtonFileIcon from '../../../../public/images/button.file.react.svg';
import ButtonTrashIcon from '../../../../public/images/button.trash.react.svg';
import ButtonMoveIcon from '../../../../public/images/button.move.react.svg';
import ButtonDuplicateIcon from '../../../../public/images/button.duplicate.react.svg';
import ButtonAlertIcon from '../../../../public/images/button.alert.react.svg';
import commonIconsStyles from '@appserver/components/utils/common-icons-style';
import ButtonPlusIcon from '../../../../public/images/actions.button.plus.react.svg';
import ButtonMinusIcon from '../../../../public/images/actions.button.minus.react.svg';
const StyledButtonAlertIcon = styled(ButtonAlertIcon)`
${commonIconsStyles}
`;
2020-11-16 11:47:30 +00:00
const FloatingButton = ({ id, className, style, ...rest }) => {
const { icon, alert, percent, onClick, color } = rest;
2020-11-16 11:47:30 +00:00
return (
2021-01-19 11:14:15 +00:00
<StyledCircleWrap
color={color}
2021-01-19 11:14:15 +00:00
id={id}
2021-06-09 10:28:22 +00:00
className={`${className} not-selectable`}
2021-01-19 11:14:15 +00:00
style={style}
icon={icon}
onClick={onClick}>
<StyledCircle percent={percent}>
2020-11-18 14:14:47 +00:00
<div className="circle__mask circle__full">
<div className="circle__fill"></div>
</div>
2020-11-18 14:14:47 +00:00
<div className="circle__mask">
<div className="circle__fill"></div>
</div>
<StyledFloatingButton color={color}>
2021-03-10 17:10:09 +00:00
<IconBox>
{icon == 'upload' ? (
2021-03-10 17:10:09 +00:00
<ButtonUploadIcon />
) : icon == 'file' ? (
2021-03-10 17:10:09 +00:00
<ButtonFileIcon />
) : icon == 'trash' ? (
2021-03-10 17:10:09 +00:00
<ButtonTrashIcon />
) : icon == 'move' ? (
2021-03-10 17:10:09 +00:00
<ButtonMoveIcon />
) : icon == 'plus' ? (
<ButtonPlusIcon />
) : icon == 'minus' ? (
<ButtonMinusIcon />
2021-03-10 17:10:09 +00:00
) : (
<ButtonDuplicateIcon />
)}
</IconBox>
<StyledAlertIcon>
{alert ? <StyledButtonAlertIcon size="medium" /> : <></>}
</StyledAlertIcon>
</StyledFloatingButton>
</StyledCircle>
</StyledCircleWrap>
2020-11-16 11:47:30 +00:00
);
};
FloatingButton.propTypes = {
id: PropTypes.string,
className: PropTypes.string,
style: PropTypes.object,
icon: PropTypes.oneOf(['upload', 'file', 'trash', 'move', 'duplicate', 'plus', 'minus']),
2020-11-16 11:47:30 +00:00
alert: PropTypes.bool,
percent: PropTypes.number,
2021-01-19 11:14:15 +00:00
onClick: PropTypes.func,
color: PropTypes.string,
2020-11-16 11:47:30 +00:00
};
FloatingButton.defaultProps = {
id: undefined,
className: undefined,
style: undefined,
icon: 'upload',
2020-11-16 11:47:30 +00:00
alert: false,
percent: 0,
2020-11-16 11:47:30 +00:00
};
export default FloatingButton;