diff --git a/frontend/src/components/search/search.js b/frontend/src/components/search/search.js index 866f9690d7..59c1e0eebe 100644 --- a/frontend/src/components/search/search.js +++ b/frontend/src/components/search/search.js @@ -1,5 +1,6 @@ -import React, { Component } from 'react'; +import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; +import MediaQuery from 'react-responsive'; import { siteRoot } from '../../utils/constants'; import SearchResultItem from './search-result-item'; import editorUtilities from '../../utils/editor-utilties'; @@ -22,7 +23,8 @@ class Search extends Component { isMaskShow: false, isResultShow: false, isResultGetted: false, - isCloseShow: false + isCloseShow: false, + isSearchInputShow: false, // for mobile }; this.inputValue = ''; this.source = null; // used to cancel request; @@ -161,7 +163,8 @@ class Search extends Component { isCloseShow: false, isResultShow: false, isResultGetted: false, - resultItems: [] + resultItems: [], + isSearchInputShow: false, }); } @@ -212,33 +215,74 @@ class Search extends Component { ); } + onSearchToggle = () => { + this.setState({ + isSearchInputShow: !this.state.isSearchInputShow, + isMaskShow: !this.state.isMaskShow, + }); + } + render() { let width = this.state.width !== 'default' ? this.state.width : ''; let style = {'width': width}; return ( -
-
-
-
- - - {this.state.isCloseShow && } + + +
+
+
+
+ + + {this.state.isCloseShow && } +
+
+ {this.renderSearchResult()} +
+
-
- {this.renderSearchResult()} + + +
+
-
-
+ {this.state.isSearchInputShow && +
+
+
+
+ + + {this.state.isCloseShow && } +
+
+ {this.renderSearchResult()} +
+
+
+ } + + ); } } diff --git a/frontend/src/components/toolbar/repo-view-toobar.js b/frontend/src/components/toolbar/repo-view-toobar.js index 7e104f7d4d..91d79026d6 100644 --- a/frontend/src/components/toolbar/repo-view-toobar.js +++ b/frontend/src/components/toolbar/repo-view-toobar.js @@ -1,5 +1,6 @@ import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; +import MediaQuery from 'react-responsive'; import { Link } from '@reach/router'; import { siteRoot, gettext } from '../../utils/constants'; import ModalPortal from '../modal-portal'; @@ -39,26 +40,31 @@ class RepoViewToolbar extends React.Component { render() { return ( -
- -
- - {this.props.libraryType !== 'group' && ( - - - {gettext('More')} - - - - {gettext('Deleted Libraries')} - - - - )} +
+ + +
+ + {this.props.libraryType !== 'group' && ( + + + {gettext('More')} + + + + {gettext('Deleted Libraries')} + + + + )} +
+
+ + +
-
{this.state.isCreateRepoDialogShow && ( )} {!this.state.isRenaming && repo.repo_name && ( - {repo.repo_name} +
{repo.repo_name}
)} {!this.state.isRenaming && !repo.repo_name && - (gettext('Broken (please contact your administrator to fix this library)')) - }
+
(gettext('Broken (please contact your administrator to fix this library)'))
+ } {repo.size} {moment(repo.last_modified).fromNow()} @@ -267,10 +267,10 @@ class MylibRepoListItem extends React.Component { let repo = this.props.repo; return ( - + {this.renderPCUI()} - + {this.renderMobileUI()} {this.state.isShareDialogShow && ( diff --git a/frontend/src/pages/my-libs/mylib-repo-list-view.js b/frontend/src/pages/my-libs/mylib-repo-list-view.js index 7e1e25a96b..414c019b1c 100644 --- a/frontend/src/pages/my-libs/mylib-repo-list-view.js +++ b/frontend/src/pages/my-libs/mylib-repo-list-view.js @@ -98,8 +98,8 @@ class MylibRepoListView extends React.Component { - - +
{gettext('Library Type')} + {gettext('Library Type')} {gettext('Sort:')} {gettext('name')} {this.props.sortBy === 'name' && sortIcon} {gettext('last update')} {this.props.sortBy === 'time' && sortIcon} @@ -117,10 +117,10 @@ class MylibRepoListView extends React.Component { render() { return ( - + {this.renderPCUI()} - + {this.renderMobileUI()} diff --git a/frontend/src/pages/my-libs/mylib-repo-menu.js b/frontend/src/pages/my-libs/mylib-repo-menu.js index 8799f7adc1..5fa4a15104 100644 --- a/frontend/src/pages/my-libs/mylib-repo-menu.js +++ b/frontend/src/pages/my-libs/mylib-repo-menu.js @@ -140,7 +140,7 @@ class MylibRepoMenu extends React.Component {
{operations.map((item, index) => { - return ({this.translateOperations(item)}); + return ({this.translateOperations(item)}); })}
diff --git a/media/css/seahub_react.css b/media/css/seahub_react.css index 8a67d2bc6c..024b3fb28b 100644 --- a/media/css/seahub_react.css +++ b/media/css/seahub_react.css @@ -210,8 +210,6 @@ ul,ol,li { .side-nav-toggle { /* just for control side-panel */ margin-right:0.9375rem; - height: 1.875rem; - line-height: 1.875rem; font-size:1.5rem; color:#999; cursor: pointer; @@ -325,14 +323,14 @@ ul,ol,li { .action-icon, .attr-action-icon { - color:#888; + color:#888 !important; } .action-icon:focus, .action-icon:hover, .attr-action-icon:focus, .attr-action-icon:hover { - color: #333; + color: #333 !important; text-decoration: none; } @@ -785,11 +783,6 @@ a.sf-popover-item:hover { .side-panel-top { padding: .5rem 1rem; } -@media (max-width: 767px) { - .side-panel-top { - border-right: 1px solid #eee; - } -} .side-panel-close { margin:10px 0 0 auto; } @@ -905,6 +898,12 @@ table td { color: green; } +@media (max-width: 767px) { + .rename-container input { + width: 10rem; + } +} + /* table-item loading-more-data */ .list-show-more { padding: 0.25rem 0.75rem; @@ -1025,39 +1024,55 @@ a.table-sort-op:focus { margin-left: 0.5rem; } -/* mobile menu */ -.item-meta-info { - display: inline-block; - margin-right: 8px; - font-size: 12px; - color: #666; -} - -.mobile-operation-menu-bg-layer { - position: fixed; - left: 0; - right: 0; - top: 0; - bottom: 0; - background: #000; - opacity: 0.1; - z-index: 3; -} - -.mobile-operation-menu { - position: fixed; - left: 0; - right: 0; - bottom: 0; - padding: .5em 0; - background: #fff; - text-align: center; - z-index: 4; -} - /* thumbnail */ .thumbnail { max-width: 24px; max-height: 24px; } +@media (max-width: 767px) { + /* mobile menu */ + .item-meta-info { + display: inline-block; + margin-right: 8px; + font-size: 12px; + color: #666; + } + + .mobile-operation-menu-bg-layer { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: #000; + opacity: 0.1; + z-index: 3; + } + + .mobile-operation-menu { + position: fixed; + left: 0; + right: 0; + bottom: 0; + padding: .5em 0; + background: #fff; + text-align: center; + z-index: 4; + } + + /* toolbar icon */ + .mobile-toolbar-icon { + color: #999; + font-size: 1.375rem; + margin-right: 0.5rem; + } + + .mobile-menu-item { + color: #000; + line-height: 2rem; + font-size: 0.875rem; + } + +} +