Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the refresh icon to the 'Change view' toolbar, left aligned #1161

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions assets/agenda/components/AgendaApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import BookmarkTabs from 'components/BookmarkTabs';
import {setActiveDate, setAgendaDropdownFilter} from 'local-store';
import {previewConfigSelector, detailsConfigSelector} from 'ui/selectors';
import {SearchResultsBar} from 'search/components/SearchResultsBar';
import NewItemsIcon from 'search/components/NewItemsIcon';

const modals = {
shareItem: ShareItemModal,
Expand Down Expand Up @@ -268,17 +267,9 @@ class AgendaApp extends SearchBase<any> {
toggleFeaturedFilter={this.props.toggleFeaturedFilter}
featuredFilter={this.props.featuredOnly}
hasAgendaFeaturedItems={this.props.hasAgendaFeaturedItems}
newItems={this.props.newItems}
fetchItems={this.props.fetchItems}
/>
{!(this.props.newItems || []).length ? null : (
<div className="navbar navbar--flex navbar--small">
<div className="navbar__inner navbar__inner--end">
<NewItemsIcon
newItems={this.props.newItems}
refresh={this.props.fetchItems}
/>
</div>
</div>
)}
</div>
<AgendaList
actions={this.props.actions}
Expand Down
18 changes: 14 additions & 4 deletions assets/agenda/components/AgendaListViewControls.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';

import AgendaFeaturedStoriesToogle from './AgendaFeaturedStoriesToogle';
import {DISPLAY_AGENDA_FEATURED_STORIES_ONLY} from 'utils';
import ListViewOptions from 'components/ListViewOptions';
import NewItemsIcon from 'search/components/NewItemsIcon';

function AgendaListViewControls({activeView, setView, hideFeaturedToggle, toggleFeaturedFilter, featuredFilter, hasAgendaFeaturedItems}: any) {
function AgendaListViewControls({activeView, setView, hideFeaturedToggle, toggleFeaturedFilter, featuredFilter, hasAgendaFeaturedItems, newItems, fetchItems}: any) {
return (
<div className="navbar navbar--flex navbar--small navbar--list-controls ">
<div className="navbar__inner navbar__inner--end">
<div className="navbar navbar--flex navbar--small navbar--list-controls">
{!(newItems || []).length ? null : (
<div className="navbar__inner navbar__inner--icon">
<NewItemsIcon
newItems={newItems}
refresh={fetchItems}
/>
</div>
)}
<div className="navbar__inner navbar__inner--end navbar__inner--buttons">
{!hideFeaturedToggle && hasAgendaFeaturedItems && DISPLAY_AGENDA_FEATURED_STORIES_ONLY &&
<AgendaFeaturedStoriesToogle onChange={toggleFeaturedFilter} featuredFilter={featuredFilter}/>
}
Expand All @@ -26,6 +34,8 @@ AgendaListViewControls.propTypes = {
hideFeaturedToggle: PropTypes.bool,
featuredFilter: PropTypes.bool,
hasAgendaFeaturedItems: PropTypes.bool,
newItems: PropTypes.array,
fetchItems: PropTypes.func,
};

export default AgendaListViewControls;
2 changes: 1 addition & 1 deletion assets/search/components/NewItemsIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class NewItemsIcon extends React.Component<IProps> {
ref={(elem: any) => this.dom.tooltip = elem}
title={gettext('refresh')}
aria-label={gettext('refresh')}
className="button__reset-styles d-flex align-items-center ms-3"
className="button__reset-styles d-flex align-items-center"
onClick={this.props.refresh}
>
<i className="icon--refresh icon--pink" />
Expand Down
10 changes: 9 additions & 1 deletion assets/styles/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -574,4 +574,12 @@ nav.search {
display: none;
}
}
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if you can handle this in the rendering code rather than with styles

.navbar--list-controls:has(.navbar__inner--icon) {
display: flex;

.navbar__inner--buttons {
display: none;
}
}
15 changes: 14 additions & 1 deletion assets/wire/components/ListViewControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import NewsOnlyControl from './NewsOnlyControl';
import SearchAllVersionsControl from './SearchAllVersionsControl';
import ListViewOptions from '../../components/ListViewOptions';
import {ListSearchOptions} from './ListSearchOptions';
import NewItemsIcon from 'search/components/NewItemsIcon';

function ListViewControls({
activeView,
Expand All @@ -18,10 +19,20 @@ function ListViewControls({
hideSearchAllVersions,
searchAllVersions,
toggleSearchAllVersions,
newItems,
fetchItems,
}: any) {
return(
<div className="navbar navbar--flex navbar--small navbar--list-controls">
<div className="navbar__inner navbar__inner--end">
{!(newItems || []).length ? null : (
<div className="navbar__inner navbar__inner--icon">
<NewItemsIcon
newItems={newItems}
refresh={fetchItems}
/>
</div>
)}
<div className="navbar__inner navbar__inner--end navbar__inner--buttons">
{hideSearchAllVersions ? null : (
<SearchAllVersionsControl
activeNavigation={activeNavigation}
Expand Down Expand Up @@ -63,6 +74,8 @@ ListViewControls.propTypes = {
hideSearchAllVersions: PropTypes.bool,
searchAllVersions: PropTypes.bool,
toggleSearchAllVersions: PropTypes.func,
newItems: PropTypes.array,
fetchItems: PropTypes.func,
};

export default ListViewControls;
13 changes: 2 additions & 11 deletions assets/wire/components/WireApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import {
listConfigSelector,
advancedSearchTabsConfigSelector,
} from 'ui/selectors';
import NewItemsIcon from 'search/components/NewItemsIcon';

const modals: any = {
shareItem: ShareItemModal,
Expand Down Expand Up @@ -238,17 +237,9 @@ class WireApp extends SearchBase<any> {
hideSearchAllVersions={!(this.props.context === 'wire' && DISPLAY_ALL_VERSIONS_TOGGLE)}
searchAllVersions={this.props.searchAllVersions}
toggleSearchAllVersions={this.props.toggleSearchAllVersions}
newItems={this.props.newItems}
fetchItems={this.props.fetchItems}
/>
{!(this.props.newItems || []).length ? null : (
<div className="navbar navbar--flex navbar--small">
<div className="navbar__inner navbar__inner--end">
<NewItemsIcon
newItems={this.props.newItems}
refresh={this.props.fetchItems}
/>
</div>
</div>
)}
</div>
<ItemsList
actions={this.props.actions}
Expand Down
Loading