1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 23:48:47 +00:00

Style bug repair (#2394)

* optimized css code

* repair search module

* repair response bug

* repair notificition bug

* repair file-history bug

* repair search info bug

* optimized code
This commit is contained in:
shanshuirenjia
2018-09-25 09:13:06 +08:00
committed by Daniel Pan
parent 490a15deed
commit 5ce1b15fb2
17 changed files with 85 additions and 153 deletions

View File

@@ -21,18 +21,31 @@ class App extends Component {
super(props); super(props);
this.state = { this.state = {
isOpen: false, isOpen: false,
isSidePanelClosed: false,
}; };
} }
onCloseSidePanel = () => {
this.setState({
isSidePanelClosed: !this.state.isSidePanelClosed
});
}
onShowSidePanel = () => {
this.setState({
isSidePanelClosed: !this.state.isSidePanelClosed
});
}
render() { render() {
let href = window.location.href.split('/'); let href = window.location.href.split('/');
let currentTab = href[href.length - 2]; let currentTab = href[href.length - 2];
return ( return (
<div id="main"> <div id="main">
<SidePanel isOpen={this.state.isOpen} toggleClose={this.isOpen} currentTab={currentTab} /> <SidePanel isSidePanelClosed={this.state.isSidePanelClosed} onCloseSidePanel={this.onCloseSidePanel} currentTab={currentTab} />
<MainPanel path='/'> <MainPanel path='/' onShowSidePanel={this.onShowSidePanel}>
<Router> <Router>
<FilesActivities path='dashboard' /> <FilesActivities path='dashboard' />
<DraftsView path='drafts' /> <DraftsView path='drafts' />

View File

@@ -45,7 +45,7 @@ class Notification extends React.Component {
<div id="notice-popover" className={`sf-popover ${this.state.showNotice ? '': 'hide'}`}> <div id="notice-popover" className={`sf-popover ${this.state.showNotice ? '': 'hide'}`}>
<div className="outer-caret up-outer-caret"><div className="inner-caret"></div></div> <div className="outer-caret up-outer-caret"><div className="inner-caret"></div></div>
<div className="sf-popover-hd ovhd"> <div className="sf-popover-hd ovhd">
<h3 className="sf-popover-title">{gettext('Notifications')}</h3> <h3 className="sf-popover-title title">{gettext('Notifications')}</h3>
<a href="#" onClick={this.onClick} title={gettext('Close')} aria-label={gettext('Close')} className="sf-popover-close js-close sf2-icon-x1 op-icon float-right"></a> <a href="#" onClick={this.onClick} title={gettext('Close')} aria-label={gettext('Close')} className="sf-popover-close js-close sf2-icon-x1 op-icon float-right"></a>
</div> </div>
<div className="sf-popover-con"> <div className="sf-popover-con">

View File

@@ -2,14 +2,7 @@ import React, { Component } from 'react';
import CommonToolbar from './toolbar/common-toolbar'; import CommonToolbar from './toolbar/common-toolbar';
class MainPanel extends Component { class MainPanel extends Component {
constructor(props) {
super(props);
}
onMenuClick = () => {
this.props.isOpen();
}
onSearchedClick = () => { onSearchedClick = () => {
//todos; //todos;
} }
@@ -20,9 +13,9 @@ class MainPanel extends Component {
<div className="main-panel o-hidden"> <div className="main-panel o-hidden">
<div className="main-panel-north"> <div className="main-panel-north">
<div className="cur-view-toolbar"> <div className="cur-view-toolbar">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.onMenuClick}></span> <span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.props.onShowSidePanel}></span>
</div> </div>
<CommonToolbar onSearchedClick={this.onSearchedClick}/> <CommonToolbar onSearchedClick={this.onSearchedClick} searchPlaceholder={'Search Files'}/>
</div> </div>
<div className="main-panel-center"> <div className="main-panel-center">
{this.props.children} {this.props.children}

View File

@@ -205,7 +205,7 @@ class Search extends Component {
onChange={this.onChangeHandler} onChange={this.onChangeHandler}
autoComplete="off" autoComplete="off"
/> />
<i className={`search-icon-right input-icon-addon fas fa-times ${this.state.isCloseShow ? "" : "hide"}`} onClick={this.onCloseHandler}></i> {this.state.isCloseShow && <i className='search-icon-right input-icon-addon fas fa-times' onClick={this.onCloseHandler}></i>}
</div> </div>
<div className="search-result-container"> <div className="search-result-container">
{this.renderSearchResult()} {this.renderSearchResult()}

View File

@@ -6,15 +6,11 @@ import SideNavFooter from './side-nav-footer';
class SidePanel extends React.Component { class SidePanel extends React.Component {
onCloseSidePanel = () => {
//todos;
}
render() { render() {
return ( return (
<div className="side-panel"> <div className={`side-panel ${this.props.isSidePanelClosed ? '' : 'left-zero'}`}>
<div className="side-panel-north"> <div className="side-panel-north">
<Logo onCloseSidePanel={this.onCloseSidePanel}/> <Logo onCloseSidePanel={this.props.onCloseSidePanel}/>
</div> </div>
<div className="side-panel-center"> <div className="side-panel-center">
<MainSideNav currentTab={this.props.currentTab}/> <MainSideNav currentTab={this.props.currentTab}/>

View File

@@ -6,14 +6,15 @@ import Notification from '../common/notification';
import Account from '../common/account'; import Account from '../common/account';
const propTypes = { const propTypes = {
onSearchedClick: PropTypes.func.isRequired onSearchedClick: PropTypes.func.isRequired,
searchPlaceholder: PropTypes.string
}; };
class CommonToolbar extends React.Component { class CommonToolbar extends React.Component {
render() { render() {
return ( return (
<div className="common-toolbar"> <div className="common-toolbar">
{isPro && <Search onSearchedClick={this.props.onSearchedClick} placeholder={gettext("Search files")}/>} {isPro && <Search onSearchedClick={this.props.onSearchedClick} placeholder={gettext(this.props.searchPlaceholder)}/>}
<Notification /> <Notification />
<Account /> <Account />
</div> </div>

View File

@@ -10,11 +10,10 @@
position: relative; position: relative;
padding: .5rem 1rem; padding: .5rem 1rem;
width: 100%; width: 100%;
border-bottom: 1px solid #e8e8e8; height: 2.5rem;
font-size: 1rem; font-size: 1rem;
font-weight: normal; font-weight: normal;
line-height: 1.5; line-height: 1.5;
height: 36px;
text-align: center; text-align: center;
} }

View File

@@ -35,7 +35,7 @@
.side-panel { .side-panel {
position:fixed; position:fixed;
left:-300px; left:-300px;
z-index:1; /* important! */ z-index: 99; /* important! */
width:300px; width:300px;
height:100%; height:100%;
background:#f8f8f8; background:#f8f8f8;
@@ -47,9 +47,9 @@
.side-panel-north, .side-panel-north,
.main-panel-north { .main-panel-north {
padding: .5rem 1rem;
display: flex; display: flex;
flex-shrink: 0; flex-shrink: 0;
padding: .5rem 1rem;
background: #f4f4f7; background: #f4f4f7;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
} }
@@ -68,43 +68,45 @@
} }
.cur-view-container { .cur-view-container {
display:flex; display: flex;
flex-direction:column; flex-direction: column;
flex:1 1 auto; flex: 1 1 auto;
overflow: hidden; overflow: hidden;
} }
.cur-view-path { .cur-view-path {
flex-shrink:0; position: relative; /* for the ':after' */
min-height:40px; padding: 8px 16px;
padding:8px 16px 0; max-height: 40px;
background:#f9f9f9; background:#f9f9f9;
position:relative; /* for the ':after' */ display: flex;
flex-shrink: 0;
justify-content: space-between;
} }
.cur-view-path:after { .cur-view-path:after {
content:''; position: absolute;
border-bottom:1px solid #e8e8e8; left: 16px;
position:absolute; right: 16px;
left:16px; bottom: 0;
right:16px; content: '';
bottom:0; border-bottom: 1px solid #e8e8e8;
} }
.cur-view-content { .cur-view-content {
padding:10px 16px 20px; padding: 10px 16px 20px;
flex:1;
height: calc(100% - 40px); height: calc(100% - 40px);
overflow:auto; flex: 1;
overflow: auto;
} }
.cur-view-content .hd { .cur-view-content .hd {
padding-bottom:0; padding-bottom: 0;
height:48px; margin-bottom: .5em;
padding:9px 10px; height: 48px;
background:#f2f2f2; padding: 9px 10px;
margin-bottom:.5em; background: #f2f2f2;
border-radius:2px; border-radius: 2px;
} }
[role=group] { [role=group] {

View File

@@ -54,7 +54,7 @@
margin-left: auto; margin-left: auto;
} }
.common-toolbar div{ .common-toolbar > div{
margin-left: .5rem; margin-left: .5rem;
} }
/* end common-toolbar */ /* end common-toolbar */

View File

@@ -39,15 +39,6 @@
padding: 30px 0 0; padding: 30px 0 0;
} }
.wiki-main .cur-view-path {
border-bottom: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
}
.wiki-main .cur-view-path::after {
display:none;
}
img[src=""] { img[src=""] {
opacity: 0; opacity: 0;
} }

View File

@@ -18,7 +18,7 @@ class MainPanel extends React.Component {
Prism.highlightAll(); Prism.highlightAll();
} }
onSelectedClick = () => { onSearchedClick = () => {
//todos; //todos;
} }
@@ -26,7 +26,7 @@ class MainPanel extends React.Component {
return ( return (
<div className="main-panel viewer"> <div className="main-panel viewer">
<div className="main-panel-north"> <div className="main-panel-north">
<CommonToolbar onSelectedClick={this.onSelectedClick} /> <CommonToolbar onSearchedClick={this.onSearchedClick} />
</div> </div>
<div className="main-panel-center history-viewer-contanier"> <div className="main-panel-center history-viewer-contanier">
<div className="content-viewer"> <div className="content-viewer">

View File

@@ -66,23 +66,21 @@ class MainPanel extends Component {
}); });
return ( return (
<div className="wiki-main-panel o-hidden"> <div className="main-panel wiki-main-panel o-hidden">
<div className="main-panel-top panel-top"> <div className="main-panel-top panel-top">
<div className="cur-view-toolbar border-left-show"> <div className="cur-view-toolbar border-left-show">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.onMenuClick}></span> <span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.onMenuClick}></span>
<div>
{ {
this.props.permission === 'rw' && this.props.permission === 'rw' &&
<button className="btn btn-secondary top-toolbar-btn" title="Edit File" onClick={this.onEditClick}>{gettext("Edit")}</button> <button className="btn btn-secondary top-toolbar-btn" title={gettext('Edit File')} onClick={this.onEditClick}>{gettext("Edit")}</button>
} }
</div>
<div className="btn-group"> <div className="btn-group">
<button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-list-view" id='list' title={gettext("List")} onClick={this.switchViewMode}></button> <button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-list-view" id='list' title={gettext("List")} onClick={this.switchViewMode}></button>
<button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-grid-view" id='grid' title={gettext("Grid")} onClick={this.switchViewMode}></button> <button className="btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-grid-view" id='grid' title={gettext("Grid")} onClick={this.switchViewMode}></button>
<button className={`btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-wiki-view ${this.state.isWikiMode ? 'current-mode' : ''}`} id='wiki' title={gettext("wiki")} onClick={this.switchViewMode}></button> <button className={`btn btn-secondary btn-icon sf-view-mode-change-btn sf2-icon-wiki-view ${this.state.isWikiMode ? 'current-mode' : ''}`} id='wiki' title={gettext("wiki")} onClick={this.switchViewMode}></button>
</div> </div>
</div> </div>
<CommonToolbar onSearchedClick={this.props.onSearchedClick} /> <CommonToolbar onSearchedClick={this.props.onSearchedClick} searchPlaceholder={'Search files in this library'}/>
</div> </div>
<div className="cur-view-container"> <div className="cur-view-container">
<div className="cur-view-path"> <div className="cur-view-path">

View File

@@ -158,7 +158,7 @@ class SidePanel extends Component {
render() { render() {
return ( return (
<div className={`wiki-side-panel ${this.props.closeSideBar ? "": "left-zero"}`}> <div className={`side-panel wiki-side-panel ${this.props.closeSideBar ? "": "left-zero"}`}>
<div className="side-panel-top panel-top"> <div className="side-panel-top panel-top">
<a href={siteRoot} id="logo"> <a href={siteRoot} id="logo">
<img src={mediaUrl + logoPath} title={siteTitle} alt="logo" width={logoWidth} height={logoHeight} /> <img src={mediaUrl + logoPath} title={siteTitle} alt="logo" width={logoWidth} height={logoHeight} />

View File

@@ -49,16 +49,16 @@ class MainPanel extends Component {
}); });
return ( return (
<div className="wiki-main-panel o-hidden"> <div className="main-panel wiki-main-panel o-hidden">
<div className="main-panel-top panel-top"> <div className="main-panel-top panel-top">
<div className="cur-view-toolbar border-left-show"> <div className="cur-view-toolbar border-left-show">
<span className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none" title="Side Nav Menu" onClick={this.onMenuClick}></span> <span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title="Side Nav Menu" onClick={this.onMenuClick}></span>
{ {
this.props.permission === 'rw' && this.props.permission === 'rw' &&
<button className="btn btn-secondary top-toolbar-btn" title="Edit File" onClick={this.onEditClick}>{gettext("Edit Page")}</button> <button className="btn btn-secondary top-toolbar-btn" title="Edit File" onClick={this.onEditClick}>{gettext("Edit Page")}</button>
} }
</div> </div>
<CommonToolbar onSearchedClick={this.props.onSearchedClick} /> <CommonToolbar onSearchedClick={this.props.onSearchedClick} searchPlaceholder={'Search files in this library'}/>
</div> </div>
<div className="cur-view-container"> <div className="cur-view-container">
<div className="cur-view-path"> <div className="cur-view-path">

View File

@@ -158,7 +158,7 @@ class SidePanel extends Component {
render() { render() {
return ( return (
<div className={`wiki-side-panel ${this.props.closeSideBar ? "": "left-zero"}`}> <div className={`side-panel wiki-side-panel ${this.props.closeSideBar ? "": "left-zero"}`}>
<div className="side-panel-top panel-top"> <div className="side-panel-top panel-top">
<a href={siteRoot} id="logo"> <a href={siteRoot} id="logo">
<img src={mediaUrl + logoPath} title={siteTitle} alt="logo" width={logoWidth} height={logoHeight} /> <img src={mediaUrl + logoPath} title={siteTitle} alt="logo" width={logoWidth} height={logoHeight} />

View File

@@ -2129,8 +2129,7 @@ button.sf-dropdown-toggle:focus {
margin-left: 8px; margin-left: 8px;
} }
#notifications a { #notifications #notice-icon {
width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;

View File

@@ -124,7 +124,7 @@ ul,ol,li {
.up-outer-caret .inner-caret { .up-outer-caret .inner-caret {
border-bottom-color:#fff; border-bottom-color:#fff;
top:1px; top:1px;
left:-18px; left:-10px;
} }
.up-outer-caret { .up-outer-caret {
position:absolute; position:absolute;
@@ -445,9 +445,12 @@ a.op-icon:focus {
} }
.side-nav-toggle { .side-nav-toggle {
margin-right:0.9375rem;
height: 1.875rem;
line-height: 1.875rem;
font-size:1.5rem; font-size:1.5rem;
color:#999; color:#999;
margin-right:15px; cursor: pointer;
} }
.side-panel-slide { .side-panel-slide {
transition: all .3s ease-in-out; transition: all .3s ease-in-out;
@@ -537,6 +540,12 @@ a.op-icon:focus {
} }
/* notifications */ /* notifications */
#notifications .title {
line-height: 1.5;
font-size: 1rem;
color: #322;
font-weight: normal;
}
#notifications .sf2-icon-bell { #notifications .sf2-icon-bell {
font-size:24px; font-size:24px;
line-height:1; line-height:1;
@@ -580,11 +589,16 @@ a.op-icon:focus {
} }
#notice-popover .brief { #notice-popover .brief {
margin-left:40px; margin-left:40px;
margin-bottom: 1rem;
font-size: 0.8125rem;
line-height: 1.5rem;
} }
#notice-popover .time { #notice-popover .time {
margin:0;
color:#999; color:#999;
text-align:right; text-align:right;
margin:0; font-size: 0.8125rem;
line-height: 1.5rem;
clear:both; clear:both;
} }
#notice-popover .view-all { #notice-popover .view-all {
@@ -645,46 +659,6 @@ a.op-icon:focus {
} }
/* basic layout */ /* basic layout */
#wrapper {
height: 100%;
}
#main {
display: flex;
height: 100%;
width: 100%;
}
.main-panel {
flex: 1 0 75%;
display:flex;
flex-direction:column;
}
.side-panel {
flex: 0 0 25%;
display:flex;
flex-direction:column;
overflow:hidden;
}
@media (max-width: 767px) {
.side-panel {
background:#f8f8f8;
width:300px;
height:100%;
position:fixed;
left:-300px;
z-index:1; /* important! */
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
transition: all 0.3s ease;
}
}
.panel-top {
padding:.5rem 1rem;
background:#f4f4f7;
border-bottom: 1px solid #e8e8e8;
display:flex;
flex-shrink:0;
}
.side-panel-top { .side-panel-top {
padding: .5rem 1rem; padding: .5rem 1rem;
} }
@@ -696,44 +670,10 @@ a.op-icon:focus {
.side-panel-close { .side-panel-close {
margin:10px 0 0 auto; margin:10px 0 0 auto;
} }
.panel-top {
.cur-view-main { padding:.5rem 1rem;
flex:1 1 auto; background:#f4f4f7;
border-bottom: 1px solid #e8e8e8;
display:flex; display:flex;
flex-direction:column;
}
.cur-view-path {
flex-shrink:0; flex-shrink:0;
min-height:40px;
padding:8px 16px 0;
background:#f9f9f9;
position:relative; /* for the ':after' */
}
.cur-view-path:after {
content:'';
border-bottom:1px solid #e8e8e8;
position:absolute;
left:16px;
right:16px;
bottom:0;
}
.cur-view-main-con {
padding:10px 16px 20px;
overflow:auto;
flex:auto;
height: calc(100% - 40px);
}
.cur-view-main-con .hd {
padding-bottom:0;
height:48px;
padding:9px 10px;
background:#f2f2f2;
margin-bottom:.5em;
border-radius:2px;
}
.main-panel-main {
flex:auto;
display:flex;
flex-direction:column;
overflow:hidden; /* for ff */
} }