2020-12-05 20:00:53 +05:30
|
|
|
import React from "react";
|
|
|
|
import clsx from "clsx";
|
|
|
|
import { ToolButton } from "./ToolButton";
|
|
|
|
import { t } from "../i18n";
|
2021-03-29 17:09:20 +03:00
|
|
|
import { useIsMobile } from "../is-mobile";
|
2020-12-05 20:00:53 +05:30
|
|
|
import { users } from "./icons";
|
|
|
|
|
|
|
|
import "./CollabButton.scss";
|
|
|
|
|
|
|
|
const CollabButton = ({
|
|
|
|
isCollaborating,
|
|
|
|
collaboratorCount,
|
|
|
|
onClick,
|
|
|
|
}: {
|
|
|
|
isCollaborating: boolean;
|
|
|
|
collaboratorCount: number;
|
|
|
|
onClick: () => void;
|
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ToolButton
|
|
|
|
className={clsx("CollabButton", {
|
|
|
|
"is-collaborating": isCollaborating,
|
|
|
|
})}
|
2021-01-05 20:06:14 +02:00
|
|
|
onClick={onClick}
|
2020-12-05 20:00:53 +05:30
|
|
|
icon={users}
|
|
|
|
type="button"
|
2021-02-08 15:43:51 -05:00
|
|
|
title={t("labels.liveCollaboration")}
|
|
|
|
aria-label={t("labels.liveCollaboration")}
|
2020-12-05 20:00:53 +05:30
|
|
|
showAriaLabel={useIsMobile()}
|
|
|
|
>
|
|
|
|
{collaboratorCount > 0 && (
|
|
|
|
<div className="CollabButton-collaborators">{collaboratorCount}</div>
|
|
|
|
)}
|
|
|
|
</ToolButton>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default CollabButton;
|