1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

Change tag list UI (#5637)

* 01 change file tags list

* 02 change select tags UI

* change edit icons
This commit is contained in:
Michael An
2023-09-13 23:12:23 +08:00
committed by GitHub
parent 14ce391007
commit 754d9c0fe8
22 changed files with 752 additions and 141 deletions

View File

@@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Button, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
import { gettext } from '../../utils/constants';
import { TAG_COLORS } from '../../constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
@@ -17,10 +18,9 @@ class CreateTagDialog extends React.Component {
super(props);
this.state = {
tagName: '',
tagColor: '',
tagColor: TAG_COLORS[0],
newTag: {},
errorMsg: '',
colorList: ['#FBD44A', '#EAA775', '#F4667C', '#DC82D2', '#9860E5', '#9F8CF1', '#59CB74', '#ADDF84', '#89D2EA', '#4ECCCB', '#46A1FD', '#C2C2C2'],
};
}
@@ -65,14 +65,7 @@ class CreateTagDialog extends React.Component {
}
};
componentDidMount() {
this.setState({
tagColor: this.state.colorList[0]
});
}
render() {
let colorList = this.state.colorList;
let canSave = this.state.tagName.trim() ? true : false;
return (
<Fragment>
@@ -90,7 +83,7 @@ class CreateTagDialog extends React.Component {
<div className="form-group">
<label className="form-label">{gettext('Select a color')}</label>
<div className="d-flex justify-content-between">
{colorList.map((item, index)=>{
{TAG_COLORS.map((item, index)=>{
return (
<div key={index} className="tag-color-option" onChange={this.selectTagcolor}>
<label className="colorinput">

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Popover, PopoverBody } from 'reactstrap';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import { TAG_COLORS } from '../../constants';
import toaster from '../toast';
import '../../css/repo-tag.css';
@@ -48,7 +49,7 @@ class TagColor extends React.Component {
const { tag } = this.props;
const { id, color } = tag;
let colorList = ['#FBD44A', '#EAA775', '#F4667C', '#DC82D2', '#9860E5', '#9F8CF1', '#59CB74', '#ADDF84', '#89D2EA', '#4ECCCB', '#46A1FD', '#C2C2C2'];
let colorList = [...TAG_COLORS];
// for color from previous color options
if (colorList.indexOf(color) == -1) {
colorList.unshift(color);