1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

Improve code for tables (#2730)

This commit is contained in:
杨顺强
2018-12-28 16:34:04 +08:00
committed by Daniel Pan
parent df39fc4162
commit 8c2944d124
11 changed files with 174 additions and 133 deletions

View File

@@ -51,7 +51,7 @@ class ListTaggedFilesDialog extends React.Component {
</ModalHeader> </ModalHeader>
<ModalBody className="dialog-list-container"> <ModalBody className="dialog-list-container">
<table> <table>
<thead className="table-thread-hidden"> <thead className="table-thead-hidden">
<tr> <tr>
<th width='50%' className="ellipsis">{gettext('Name')}</th> <th width='50%' className="ellipsis">{gettext('Name')}</th>
<th width='25%'>{gettext('Size')}</th> <th width='25%'>{gettext('Size')}</th>

View File

@@ -109,7 +109,7 @@ class ShareDialog extends React.Component {
<div> <div>
<Modal isOpen={true} style={{maxWidth: '720px'}} className="share-dialog"> <Modal isOpen={true} style={{maxWidth: '720px'}} className="share-dialog">
<ModalHeader toggle={this.props.toggleDialog}>{gettext('Share')} <span className="sf-font" title={itemName}>{itemName}</span></ModalHeader> <ModalHeader toggle={this.props.toggleDialog}>{gettext('Share')} <span className="sf-font" title={itemName}>{itemName}</span></ModalHeader>
<ModalBody className="share-dialog-content"> <ModalBody className="dialog-list-container share-dialog-content">
{(itemType === 'library' || itemType === 'dir') && this.renderDirContent()} {(itemType === 'library' || itemType === 'dir') && this.renderDirContent()}
{itemType === 'file' && this.renderFileContent()} {itemType === 'file' && this.renderFileContent()}
</ModalBody> </ModalBody>

View File

@@ -1,4 +1,4 @@
import React from 'react'; import React, { Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import Select from 'react-select'; import Select from 'react-select';
@@ -246,13 +246,16 @@ class ShareToGroup extends React.Component {
render() { render() {
return ( return (
<Fragment>
<table> <table>
<thead> <thead>
<tr> <tr>
<th style={{'width': '40%'}}>{gettext('Group')}</th> <th width="40%">{gettext('Group')}</th>
<th style={{'width': '40%'}}>{gettext('Permission')}</th> <th width="40%">{gettext('Permission')}</th>
<th></th> <th width="20%"></th>
</tr> </tr>
</thead>
<tbody>
<tr> <tr>
<td> <td>
<Select <Select
@@ -288,6 +291,16 @@ class ShareToGroup extends React.Component {
); );
}) })
} }
</tbody>
</table>
<div className="share-list-container">
<table className="table-thead-hidden">
<thead>
<tr>
<th width="40%">{gettext('Group')}</th>
<th width="40%">{gettext('Permission')}</th>
<th width="20%"></th>
</tr>
</thead> </thead>
<GroupList <GroupList
items={this.state.sharedItems} items={this.state.sharedItems}
@@ -296,6 +309,8 @@ class ShareToGroup extends React.Component {
onChangeUserPermission={this.onChangeUserPermission} onChangeUserPermission={this.onChangeUserPermission}
/> />
</table> </table>
</div>
</Fragment>
); );
} }
} }

View File

@@ -263,13 +263,16 @@ class ShareToUser extends React.Component {
render() { render() {
let { sharedItems } = this.state; let { sharedItems } = this.state;
return ( return (
<Fragment>
<table> <table>
<thead> <thead>
<tr> <tr>
<th style={{'width': '40%'}}>{gettext('User')}</th> <th width="40%">{gettext('User')}</th>
<th style={{'width': '40%'}}>{gettext('Permission')}</th> <th width="40%">{gettext('Permission')}</th>
<th></th> <th width="20%"></th>
</tr> </tr>
</thead>
<tbody>
<tr> <tr>
<td> <td>
<AsyncSelect <AsyncSelect
@@ -313,6 +316,16 @@ class ShareToUser extends React.Component {
); );
}) })
} }
</tbody>
</table>
<div className="share-list-container">
<table className="table-thead-hidden">
<thead>
<tr>
<th width="40%">{gettext('User')}</th>
<th width="40%">{gettext('Permission')}</th>
<th width="20%"></th>
</tr>
</thead> </thead>
<UserList <UserList
items={sharedItems} items={sharedItems}
@@ -321,6 +334,8 @@ class ShareToUser extends React.Component {
onChangeUserPermission={this.onChangeUserPermission} onChangeUserPermission={this.onChangeUserPermission}
/> />
</table> </table>
</div>
</Fragment>
); );
} }
} }

View File

@@ -111,7 +111,7 @@ class DetailListView extends React.Component {
); );
})} })}
</ul> </ul>
<i className='fa fa-pencil tag-edit-icon' onClick={this.onEditFileTagToggle}></i> <i className='fa fa-pencil attr-action-icon' onClick={this.onEditFileTagToggle}></i>
</td> </td>
</tr> </tr>
<tr className="file-related-files"> <tr className="file-related-files">

View File

@@ -80,8 +80,7 @@ class PermissionEditor extends React.Component {
{this.props.isEditIconShow && ( {this.props.isEditIconShow && (
<span <span
title={gettext('Edit')} title={gettext('Edit')}
style={{fontSize: '0.875rem', marginLeft: '0.5rem'}} className="fa fa-pencil attr-action-icon"
className="fa fa-pencil action-icon"
onClick={this.onEidtPermission}> onClick={this.onEidtPermission}>
</span> </span>
)} )}

View File

@@ -52,7 +52,7 @@ class SharedRepoListView extends React.Component {
let isShowTableThread = this.props.isShowTableThread !== undefined ? this.props.isShowTableThread : true; let isShowTableThread = this.props.isShowTableThread !== undefined ? this.props.isShowTableThread : true;
return ( return (
<table> <table>
<thead className={isShowTableThread ? '' : 'table-thread-hidden'}> <thead className={isShowTableThread ? '' : 'table-thead-hidden'}>
<tr> <tr>
<th width="4%"><span className="sr-only">{gettext("Library Type")}</span></th> <th width="4%"><span className="sr-only">{gettext("Library Type")}</span></th>
<th width="40%">{gettext("Name")} <th width="40%">{gettext("Name")}

View File

@@ -70,16 +70,6 @@
right: 0.5rem; right: 0.5rem;
} }
.tag-edit-icon {
padding: 0 0.5rem;
color: #888;
cursor: pointer;
}
.tag-edit-icon:hover {
color: #333;
}
.file-tag-item { .file-tag-item {
margin: 0.25rem 0; margin: 0.25rem 0;
padding: 0 0.5rem; padding: 0 0.5rem;

View File

@@ -3,6 +3,7 @@
min-height: 15rem; min-height: 15rem;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
overflow: hidden;
} }
.share-dialog-content .share-dialog-side { .share-dialog-content .share-dialog-side {
@@ -21,6 +22,11 @@
flex: 1; flex: 1;
} }
.share-list-container {
max-height: 15rem;
overflow: auto;
}
.share-dialog-content label { .share-dialog-content label {
padding: 0.5rem 0 0.25rem; padding: 0.5rem 0 0.25rem;
} }

View File

@@ -196,7 +196,7 @@ class Item extends Component {
let iconVisibility = this.state.showOpIcon ? '' : ' invisible'; let iconVisibility = this.state.showOpIcon ? '' : ' invisible';
let shareIconClassName = 'op-icon sf2-icon-share repo-share-btn' + iconVisibility; let shareIconClassName = 'op-icon sf2-icon-share repo-share-btn' + iconVisibility;
let leaveShareIconClassName = 'op-icon sf2-icon-delete' + iconVisibility; let leaveShareIconClassName = 'op-icon sf2-icon-x3' + iconVisibility;
const desktopItem = ( const desktopItem = (
<tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}> <tr onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>

View File

@@ -150,6 +150,7 @@ ul,ol,li {
} }
.sf-dropdown-toggle { .sf-dropdown-toggle {
margin-left: 0.5rem;
vertical-align: middle; vertical-align: middle;
font-style: normal; font-style: normal;
font-size: 0.85rem; font-size: 0.85rem;
@@ -166,8 +167,9 @@ ul,ol,li {
user-select: none; user-select: none;
} }
.dialog-list-container { /*for content is list dialog*/ .dialog-list-container { /* for dialog containing list */
height: 20rem; min-height: 15rem;
max-height: 35rem;
overflow: auto; overflow: auto;
} }
@@ -297,8 +299,9 @@ ul,ol,li {
/** op-icon **/ /** op-icon **/
.op-icon, .op-icon,
.action-icon { .action-icon,
margin-right: 0.5rem; .attr-action-icon {
margin-left: 0.5rem;
font-size: 1.25rem; font-size: 1.25rem;
font-style: normal; font-style: normal;
line-height: 1; line-height: 1;
@@ -316,16 +319,24 @@ ul,ol,li {
border-bottom: 0.125rem solid #f89a68; border-bottom: 0.125rem solid #f89a68;
} }
.action-icon { .action-icon,
.attr-action-icon {
margin-right: 0.25rem;
color:#888; color:#888;
} }
.action-icon:focus, .action-icon:focus,
.action-icon:hover { .action-icon:hover,
.attr-action-icon:focus,
.attr-action-icon:hover {
color: #333; color: #333;
text-decoration: none; text-decoration: none;
} }
.attr-action-icon {
font-size: 0.875rem;
}
/** Account info **/ /** Account info **/
#account { #account {
position:relative; position:relative;
@@ -837,7 +848,12 @@ table td img {
height: 1.5rem; height: 1.5rem;
} }
.table-thread-hidden th { /* hide table th */ .table-thead-hidden thead tr {
height: 0;
border: 0;
}
.table-thead-hidden th { /* hide table th */
padding: 0; padding: 0;
border: 0; border: 0;
font-size: 0; font-size: 0;