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

12.0 change dropdown menu style (#6227)

* 01 remove 200px dropdown menu

* 02 change check mark icon className

* 03 change dropdown padding

* 04 change menu min width 200px

* 05 change sort repos dropdown
This commit is contained in:
Michael An
2024-06-19 15:16:54 +08:00
committed by GitHub
parent dfe4278679
commit d722b852fe
20 changed files with 735 additions and 674 deletions

View File

@@ -91,7 +91,7 @@ class CreateTagDialog extends React.Component {
<input name="color" type="radio" value={item} className="colorinput-input" defaultChecked onClick={this.selectTagcolor}></input> : <input name="color" type="radio" value={item} className="colorinput-input" defaultChecked onClick={this.selectTagcolor}></input> :
<input name="color" type="radio" value={item} className="colorinput-input" onClick={this.selectTagcolor}></input>} <input name="color" type="radio" value={item} className="colorinput-input" onClick={this.selectTagcolor}></input>}
<span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor:item}}> <span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor:item}}>
<i className="fas fa-check color-selected"></i> <i className="sf2-icon-tick color-selected"></i>
</span> </span>
</label> </label>
</div> </div>

View File

@@ -91,7 +91,7 @@ class TagItem extends React.Component {
<span className="tag-color w-4 h-4 rounded-circle" style={{backgroundColor: repoTag.color}}></span> <span className="tag-color w-4 h-4 rounded-circle" style={{backgroundColor: repoTag.color}}></span>
<span className="tag-name mx-2">{repoTag.name}</span> <span className="tag-name mx-2">{repoTag.name}</span>
</div> </div>
{isTagSelected && <i className="fas fa-check tag-selected-icon"></i>} {isTagSelected && <i className="sf2-icon-tick tag-selected-icon"></i>}
</li> </li>
); );
} }

View File

@@ -88,7 +88,7 @@ class TagColor extends React.Component {
<label className="colorinput"> <label className="colorinput">
<input name="color" type="radio" value={item} className="colorinput-input" defaultChecked={item == tagColor} onClick={this.selectTagColor} /> <input name="color" type="radio" value={item} className="colorinput-input" defaultChecked={item == tagColor} onClick={this.selectTagColor} />
<span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor: item}}> <span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor: item}}>
<i className="fas fa-check color-selected"></i> <i className="sf2-icon-tick color-selected"></i>
</span> </span>
</label> </label>
</div> </div>

View File

@@ -66,7 +66,7 @@ class TagItem extends React.Component {
<div className="tag-item d-flex align-items-center" style={{backgroundColor: repoTag.color}}> <div className="tag-item d-flex align-items-center" style={{backgroundColor: repoTag.color}}>
<span className="tag-name">{repoTag.name}</span> <span className="tag-name">{repoTag.name}</span>
</div> </div>
{isTagSelected && <i className="fas fa-check tag-selected-icon"></i>} {isTagSelected && <i className="sf2-icon-tick tag-selected-icon"></i>}
</li> </li>
); );
} }

View File

@@ -80,7 +80,7 @@ export default class VirtualTagColor extends React.Component {
<label className="colorinput"> <label className="colorinput">
<input name="color" type="radio" value={item} className="colorinput-input" defaultChecked={item == tagColor} onClick={this.selectTagColor} /> <input name="color" type="radio" value={item} className="colorinput-input" defaultChecked={item == tagColor} onClick={this.selectTagColor} />
<span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor: item}}> <span className="colorinput-color rounded-circle d-flex align-items-center justify-content-center" style={{backgroundColor: item}}>
<i className="fas fa-check color-selected"></i> <i className="sf2-icon-tick color-selected"></i>
</span> </span>
</label> </label>
</div> </div>

View File

@@ -0,0 +1,66 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
import { gettext } from '../utils/constants';
const propTypes = {
sortOptions: PropTypes.array,
onSelectSortOption: PropTypes.func.isRequired
};
class ReposSortMenu extends React.Component {
constructor(props) {
super(props);
this.state = {
isDropdownMenuOpen: false
};
}
toggleDropdownMenu = () => {
this.setState({
isDropdownMenuOpen: !this.state.isDropdownMenuOpen
});
};
render() {
const { isDropdownMenuOpen } = this.state;
const { sortOptions } = this.props;
return (
<Dropdown
isOpen={isDropdownMenuOpen}
toggle={this.toggleDropdownMenu}
>
<DropdownToggle
tag="div"
data-toggle="dropdown"
title={gettext('Switch view mode')}
aria-label={gettext('Switch view mode')}
aria-expanded={isDropdownMenuOpen}
>
<span className="cur-view-path-btn px-1" role="button">
<i className="sf3-font-sort2 sf3-font"></i>
<i className="sf3-font-down sf3-font"></i>
</span>
</DropdownToggle>
<DropdownMenu right={true} className="mt-1">
{sortOptions.map((item, index) => {
return (
<DropdownItem key={index} onClick={this.props.onSelectSortOption.bind(this, item)}>
<div className="d-flex justify-content-between align-items-center">
<span className="mr-8">{item.text}</span>
<span>{item.isSelected && <i className="sf2-icon-tick"></i>}</span>
</div>
</DropdownItem>
);
})}
</DropdownMenu>
</Dropdown>
);
}
}
ReposSortMenu.propTypes = propTypes;
export default ReposSortMenu;

View File

@@ -85,7 +85,7 @@ class Selector extends Component {
return ( return (
<li key={index} className="option-item h-6 py-1 px-3 d-flex justify-content-between align-items-center" onClick={(e) => {this.selectItem(e, item);}}> <li key={index} className="option-item h-6 py-1 px-3 d-flex justify-content-between align-items-center" onClick={(e) => {this.selectItem(e, item);}}>
<span className="option-item-text flex-shrink-0 mr-3">{item.text}</span> <span className="option-item-text flex-shrink-0 mr-3">{item.text}</span>
<i className={`sf2-icon-tick text-gray font-weight-bold ${item.isSelected ? '' : 'invisible'}`}></i> <i className={`sf2-icon-tick ${item.isSelected ? '' : 'invisible'}`}></i>
</li> </li>
); );
})} })}

View File

@@ -236,7 +236,7 @@ class DirOperationToolbar extends React.Component {
{this.props.children} {this.props.children}
<i className="sf3-font-drop-down sf3-font ml-1 path-item-dropdown-toggle"></i> <i className="sf3-font-drop-down sf3-font ml-1 path-item-dropdown-toggle"></i>
</DropdownToggle> </DropdownToggle>
<DropdownMenu onMouseMove={this.onDropDownMouseMove} style={{'width': '200px'}}> <DropdownMenu onMouseMove={this.onDropDownMouseMove}>
{opList.map((item, index)=> { {opList.map((item, index)=> {
if (item == 'Divider') { if (item == 'Divider') {
return <DropdownItem key={index} divider />; return <DropdownItem key={index} divider />;
@@ -252,7 +252,7 @@ class DirOperationToolbar extends React.Component {
> >
<DropdownToggle <DropdownToggle
caret caret
className="dropdown-item font-weight-normal rounded-0 d-flex align-items-center pr-2" className="dropdown-item font-weight-normal rounded-0 d-flex align-items-center"
onMouseEnter={this.toggleSubMenuShown.bind(this, item)} onMouseEnter={this.toggleSubMenuShown.bind(this, item)}
> >
<i className={`sf3-font-${item.icon} sf3-font mr-2 dropdown-item-icon`}></i> <i className={`sf3-font-${item.icon} sf3-font mr-2 dropdown-item-icon`}></i>

View File

@@ -46,7 +46,7 @@ class SingleDropdownToolbar extends React.Component {
data-toggle="dropdown" data-toggle="dropdown"
> >
</DropdownToggle> </DropdownToggle>
<DropdownMenu style={{'width': '200px'}}> <DropdownMenu>
{opList.map((item, index)=> { {opList.map((item, index)=> {
if (item == 'Divider') { if (item == 'Divider') {
return <DropdownItem key={index} divider />; return <DropdownItem key={index} divider />;

View File

@@ -158,7 +158,7 @@ class ViewFileToolbar extends React.Component {
{this.props.children} {this.props.children}
<i className="sf3-font-drop-down sf3-font ml-1 path-item-dropdown-toggle"></i> <i className="sf3-font-drop-down sf3-font ml-1 path-item-dropdown-toggle"></i>
</DropdownToggle> </DropdownToggle>
<DropdownMenu onMouseMove={this.onDropDownMouseMove} style={{'width': '200px'}}> <DropdownMenu onMouseMove={this.onDropDownMouseMove}>
{opList.map((item, index)=> { {opList.map((item, index)=> {
if (item == 'Divider') { if (item == 'Divider') {
return <DropdownItem key={index} divider />; return <DropdownItem key={index} divider />;
@@ -174,7 +174,7 @@ class ViewFileToolbar extends React.Component {
> >
<DropdownToggle <DropdownToggle
caret caret
className="dropdown-item font-weight-normal rounded-0 d-flex align-items-center pr-2" className="dropdown-item font-weight-normal rounded-0 d-flex align-items-center"
onMouseEnter={this.toggleSubMenuShown.bind(this, item)} onMouseEnter={this.toggleSubMenuShown.bind(this, item)}
> >
<i className={`sf3-font-${item.icon} sf3-font mr-2 dropdown-item-icon`}></i> <i className={`sf3-font-${item.icon} sf3-font mr-2 dropdown-item-icon`}></i>

View File

@@ -58,7 +58,7 @@ class ViewModes extends React.Component {
<span>{item.text}</span> <span>{item.text}</span>
</span> </span>
<span> <span>
{currentViewMode === item.value && <i className="fas fa-check color-selected"></i>} {currentViewMode === item.value && <i className="sf2-icon-tick"></i>}
</span> </span>
</div> </div>
</DropdownItem> </DropdownItem>

View File

@@ -37,10 +37,6 @@
margin-right: 0.25rem; margin-right: 0.25rem;
} }
.history-body .dropdown-menu {
min-width: 8rem;
}
.history-body .dropdown-menu a { .history-body .dropdown-menu a {
text-decoration: none; text-decoration: none;
color: #6e7687; color: #6e7687;

View File

@@ -153,10 +153,6 @@
color:#fff; color:#fff;
} }
.dropdown-menu {
min-width: 8rem;
}
.parent-path { .parent-path {
position: relative; position: relative;
} }

View File

@@ -177,10 +177,6 @@
color:#fff; color:#fff;
} }
.dropdown-menu {
min-width: 8rem;
}
.parent-path { .parent-path {
position: relative; position: relative;
} }

View File

@@ -39,20 +39,6 @@
margin-right: -4px; margin-right: -4px;
} }
#cur-view-change-mode-dropdown .dropdown-item {
padding: 4px 16px;
}
#cur-view-change-mode-dropdown .dropdown-item .fas,
#cur-view-change-mode-dropdown .dropdown-item .sf3-font {
color: #666;
}
#cur-view-change-mode-dropdown .dropdown-item:hover .fas,
#cur-view-change-mode-dropdown .dropdown-item:hover .sf3-font {
color: #fff;
}
/* begin common-toolbar */ /* begin common-toolbar */
.common-toolbar { .common-toolbar {
display: flex; display: flex;

View File

@@ -46,7 +46,6 @@
} }
.notification-header-close .dropdown-menu { .notification-header-close .dropdown-menu {
min-width: 8rem;
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
} }

View File

@@ -8,8 +8,8 @@ import toaster from '../../components/toast';
import Repo from '../../models/repo'; import Repo from '../../models/repo';
import Group from '../../models/group'; import Group from '../../models/group';
import Loading from '../../components/loading'; import Loading from '../../components/loading';
import Selector from '../../components/single-selector';
import ViewModes from '../../components/view-modes'; import ViewModes from '../../components/view-modes';
import ReposSortMenu from '../../components/repos-sort-menu';
import TopToolbar from '../../components/toolbar/top-toolbar'; import TopToolbar from '../../components/toolbar/top-toolbar';
import SingleDropdownToolbar from '../../components/toolbar/single-dropdown-toolbar'; import SingleDropdownToolbar from '../../components/toolbar/single-dropdown-toolbar';
import SortOptionsDialog from '../../components/dialog/sort-options'; import SortOptionsDialog from '../../components/dialog/sort-options';
@@ -237,14 +237,6 @@ class Libraries extends Component {
isSelected: item.value == `${sortBy}-${sortOrder}` isSelected: item.value == `${sortBy}-${sortOrder}`
}; };
}); });
const customSelectorToggle = (
<span className="cur-view-path-btn px-1" role="button">
<i className="sf3-font-sort2 sf3-font"></i>
<i className="sf3-font-down sf3-font"></i>
</span>
);
return ( return (
<Fragment> <Fragment>
<TopToolbar <TopToolbar
@@ -258,15 +250,10 @@ class Libraries extends Component {
<h3 className="sf-heading m-0">{gettext('Files')}</h3> <h3 className="sf-heading m-0">{gettext('Files')}</h3>
{isDesktop && {isDesktop &&
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<div className="view-modes mr-2"> <div className="mr-2">
<ViewModes currentViewMode={currentViewMode} switchViewMode={this.switchViewMode} /> <ViewModes currentViewMode={currentViewMode} switchViewMode={this.switchViewMode} />
</div> </div>
<Selector <ReposSortMenu sortOptions={sortOptions} onSelectSortOption={this.onSelectSortOption}/>
customSelectorToggle={customSelectorToggle}
options={sortOptions}
selectOption={this.onSelectSortOption}
menuCustomClass='repos-sort-menu dropdown-menu-right'
/>
</div> </div>
} }
</div> </div>

View File

@@ -269,10 +269,6 @@
min-height: 22.5px; min-height: 22.5px;
} }
.sdoc-file-history-versions .dropdown-menu {
min-width: 8rem;
}
.history-content .main-panel { .history-content .main-panel {
flex: 1 1 auto; flex: 1 1 auto;
} }

View File

@@ -249,7 +249,7 @@
} }
.view-operation-dropdown-menu .sf3-font { .view-operation-dropdown-menu .sf3-font {
font-size: 10px; font-size: 14px;
margin-right: 10px; margin-right: 10px;
} }
@@ -306,7 +306,6 @@
} }
.view-structure .folders-dropdown .dropdown-menu { .view-structure .folders-dropdown .dropdown-menu {
max-width: 180px;
max-height: 300px; max-height: 300px;
overflow-y: auto; overflow-y: auto;
} }

File diff suppressed because it is too large Load Diff