mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-24 04:48:03 +00:00
[tag popup] improvements: 'add tag link', 'more colors', 'darker color'
This commit is contained in:
@@ -16,7 +16,7 @@ class CreateTagDialog extends React.Component {
|
|||||||
tagName: '',
|
tagName: '',
|
||||||
tagColor: '',
|
tagColor: '',
|
||||||
newTag: {},
|
newTag: {},
|
||||||
colorList: ['lime', 'teal', 'azure', 'green', 'blue', 'purple', 'pink', 'indigo'],
|
colorList: ['blue', 'azure', 'indigo', 'purple', 'pink', 'red', 'orange', 'yellow', 'lime', 'green', 'teal', 'cyan', 'gray']
|
||||||
};
|
};
|
||||||
this.newInput = React.createRef();
|
this.newInput = React.createRef();
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
|||||||
import { gettext } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import RepoTag from '../../models/repo-tag';
|
import RepoTag from '../../models/repo-tag';
|
||||||
|
|
||||||
import '../../css/repo-tag.css';
|
import '../../css/repo-tag.css';
|
||||||
|
|
||||||
const tagListItemPropTypes = {
|
const tagListItemPropTypes = {
|
||||||
@@ -14,6 +15,25 @@ const tagListItemPropTypes = {
|
|||||||
|
|
||||||
class TagListItem extends React.Component {
|
class TagListItem extends React.Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
showSelectedTag: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onMouseOver = () => {
|
||||||
|
this.setState({
|
||||||
|
showSelectedTag: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMouseOut = () => {
|
||||||
|
this.setState({
|
||||||
|
showSelectedTag: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onTagUpdate = () => {
|
onTagUpdate = () => {
|
||||||
this.props.onTagUpdate(this.props.item);
|
this.props.onTagUpdate(this.props.item);
|
||||||
}
|
}
|
||||||
@@ -24,14 +44,15 @@ class TagListItem extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let color = this.props.item.color;
|
let color = this.props.item.color;
|
||||||
return(
|
return (
|
||||||
<li className="tag-list-item">
|
<li className="tag-list-item">
|
||||||
<span className={`tag-demo bg-${color}`}>
|
<div className={`tag-demo bg-${color}`} onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut}>
|
||||||
|
<span className={`bg-${color}-dark ${this.state.showSelectedTag ? 'show-tag-selected': ''}`}></span>
|
||||||
<span className="tag-name">{this.props.item.name}</span>
|
<span className="tag-name">{this.props.item.name}</span>
|
||||||
<span className="tag-files" onClick={this.onListTaggedFiles}>
|
<span className="tag-files" onClick={this.onListTaggedFiles}>
|
||||||
{this.props.item.fileCount}{' '}{gettext('files')}
|
{this.props.item.fileCount}{' '}{gettext('files')}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</div>
|
||||||
<i className="tag-edit fa fa-pencil" onClick={this.onTagUpdate}></i>
|
<i className="tag-edit fa fa-pencil" onClick={this.onTagUpdate}></i>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
@@ -74,34 +95,32 @@ class ListTagDialog extends React.Component {
|
|||||||
this.props.onListTagCancel();
|
this.props.onListTagCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createNewTag = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.props.onCreateRepoTag();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Modal isOpen={true} toggle={this.toggle}>
|
<Modal isOpen={true} toggle={this.toggle}>
|
||||||
<ModalHeader toggle={this.toggle}>{gettext('Tags')}</ModalHeader>
|
<ModalHeader toggle={this.toggle}>{gettext('Tags')}</ModalHeader>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
{this.state.repotagList.length === 0 && (
|
<ul className="tag-list tag-list-container">
|
||||||
<div className="tag-list tag-list-container">
|
{this.state.repotagList.map((repoTag, index) => {
|
||||||
{gettext('Click new tag button to create tags.')}
|
return (
|
||||||
</div>
|
<TagListItem
|
||||||
)}
|
key={index}
|
||||||
{this.state.repotagList.length > 0 && (
|
item={repoTag}
|
||||||
<ul className="tag-list tag-list-container">
|
onTagUpdate={this.props.onUpdateRepoTag}
|
||||||
{this.state.repotagList.map((repoTag, index) => {
|
onListTaggedFiles={this.props.onListTaggedFiles}
|
||||||
return (
|
/>
|
||||||
<TagListItem
|
);
|
||||||
key={index}
|
})}
|
||||||
item={repoTag}
|
</ul>
|
||||||
onTagUpdate={this.props.onUpdateRepoTag}
|
<a href="#" className="add-tag-link" onClick={this.createNewTag}>{gettext('Create a new tag')}</a>
|
||||||
onListTaggedFiles={this.props.onListTaggedFiles}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</ul>
|
|
||||||
)}
|
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button color="primary" onClick={this.props.onCreateRepoTag}>{gettext('New Tag')}</Button>
|
|
||||||
<Button color="secondary" onClick={this.toggle}>{gettext('Close')}</Button>
|
<Button color="secondary" onClick={this.toggle}>{gettext('Close')}</Button>
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@@ -17,7 +17,7 @@ class UpdateTagDialog extends React.Component {
|
|||||||
deleteRepoTag: false,
|
deleteRepoTag: false,
|
||||||
newName: this.props.currentTag.name,
|
newName: this.props.currentTag.name,
|
||||||
newColor: this.props.currentTag.color,
|
newColor: this.props.currentTag.color,
|
||||||
colorList: ['lime', 'teal', 'azure', 'green', 'blue', 'purple', 'pink', 'indigo'],
|
colorList: ['blue', 'azure', 'indigo', 'purple', 'pink', 'red', 'orange', 'yellow', 'lime', 'green', 'teal', 'cyan', 'gray']
|
||||||
};
|
};
|
||||||
this.newInput = React.createRef();
|
this.newInput = React.createRef();
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,21 @@
|
|||||||
.tag-list-container {
|
.tag-list-container {
|
||||||
padding: 0.5rem;
|
|
||||||
padding-bottom: 0;
|
|
||||||
max-height: 15rem;
|
max-height: 15rem;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.add-tag-link {
|
||||||
|
display: block;
|
||||||
|
color: #666;
|
||||||
|
padding: .4rem .5rem;
|
||||||
|
border-radius: 4px;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
.add-tag-link:hover {
|
||||||
|
color: #444;
|
||||||
|
background: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
.tag-list-item {
|
.tag-list-item {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -17,18 +27,20 @@
|
|||||||
.tag-list-item .tag-demo {
|
.tag-list-item .tag-demo {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
padding-left: 0.5rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-list-item .tag-demo:hover {
|
.show-tag-selected {
|
||||||
border-left: 0.75rem solid #eb8205;
|
width: .5em;
|
||||||
|
align-self: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-demo .tag-name {
|
.tag-demo .tag-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
padding-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-demo .tag-files {
|
.tag-demo .tag-files {
|
||||||
|
Reference in New Issue
Block a user