Web: Files : Home : Added share button at row

This commit is contained in:
Ilya Oleshko 2020-10-09 17:08:29 +03:00
parent 5e8a4727ac
commit a129bda5ee

View File

@ -14,6 +14,7 @@ import {
Link, Link,
DragAndDrop, DragAndDrop,
Box, Box,
Text
} from "asc-web-components"; } from "asc-web-components";
import EmptyFolderContainer from "./EmptyFolderContainer"; import EmptyFolderContainer from "./EmptyFolderContainer";
import FilesRowContent from "./FilesRowContent"; import FilesRowContent from "./FilesRowContent";
@ -121,6 +122,13 @@ const SimpleFilesRow = styled(Row)`
width: 0px; width: 0px;
} }
`} `}
.share-button:hover {
cursor: pointer;
div {
color: "#657077"
}
}
`; `;
class SectionBodyContent extends React.Component { class SectionBodyContent extends React.Component {
@ -382,12 +390,10 @@ class SectionBodyContent extends React.Component {
copy( copy(
isFile isFile
? isMediaOrImage(item.fileExst) ? isMediaOrImage(item.fileExst)
? `${window.location.origin + settings.homepage}/filter?folder=${ ? `${window.location.origin + settings.homepage}/filter?folder=${item.folderId
item.folderId
}&preview=${item.id}` }&preview=${item.id}`
: item.webUrl : item.webUrl
: `${window.location.origin + settings.homepage}/filter?folder=${ : `${window.location.origin + settings.homepage}/filter?folder=${item.id
item.id
}` }`
); );
@ -1277,6 +1283,30 @@ class SectionBodyContent extends React.Component {
}); });
}; };
getSharedButton = () => {
return (
<Text
className="share-button"
as='span'
title={"Share"}
fontSize='12px'
fontWeight={400}
color='#A3A9AE'
display="inline-flex"
onClick={this.onClickShare}
>
<IconButton
className="share-button"
color='#a3a9ae'
hoverColor="#657077"
size={16}
iconName='CatalogSharedIcon'
style={{ marginRight: "8px" }}
/>
Share
</Text>)
}
render() { render() {
const { const {
files, files,
@ -1473,6 +1503,9 @@ class SectionBodyContent extends React.Component {
const element = this.getItemIcon(item, isEdit || item.id <= 0); const element = this.getItemIcon(item, isEdit || item.id <= 0);
const classNameProp = const classNameProp =
isFolder && item.access < 2 ? { className: " dropable" } : {}; isFolder && item.access < 2 ? { className: " dropable" } : {};
const sharedButton = this.getSharedButton();
const displayShareButton = widthProp > 500 ? '96px' : '26px';
return ( return (
<DragAndDrop <DragAndDrop
{...classNameProp} {...classNameProp}
@ -1488,12 +1521,14 @@ class SectionBodyContent extends React.Component {
key={item.id} key={item.id}
data={item} data={item}
element={element} element={element}
contentElement={sharedButton}
onSelect={this.onContentRowSelect} onSelect={this.onContentRowSelect}
editing={editingId} editing={editingId}
{...checkedProps} {...checkedProps}
{...contextOptionsProps} {...contextOptionsProps}
needForUpdate={this.needForUpdate} needForUpdate={this.needForUpdate}
selectItem={this.onSelectItem.bind(this, item)} selectItem={this.onSelectItem.bind(this, item)}
contextButtonSpacerWidth={displayShareButton}
> >
<FilesRowContent <FilesRowContent
widthProp={widthProp} widthProp={widthProp}