-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
search: added CommuniitiesStatusFilter component
- Loading branch information
1 parent
3061252
commit e118fba
Showing
3 changed files
with
81 additions
and
58 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
.../semantic-ui/js/invenio_communities/community/searchComponents/CommunitiesStatusFilter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { i18next } from "@translations/invenio_rdm_records/i18next"; | ||
|
||
import React, { Component } from "react"; | ||
|
||
import { Menu } from "semantic-ui-react"; | ||
import PropTypes from "prop-types"; | ||
|
||
export class CommunitiesStatusFilter extends Component { | ||
render() { | ||
const { | ||
myCommunitiesOnClick, | ||
allCommunitiesOnClick, | ||
appID, | ||
allCommunitiesSelected, | ||
} = this.props; | ||
|
||
return ( | ||
<Menu role="tablist" className="theme-primary-menu" compact> | ||
<Menu.Item | ||
as="button" | ||
role="tab" | ||
id="all-communities-tab" | ||
aria-selected={allCommunitiesSelected} | ||
aria-controls={appID} | ||
name="All" | ||
active={allCommunitiesSelected} | ||
onClick={allCommunitiesOnClick} | ||
> | ||
{i18next.t("All")} | ||
</Menu.Item> | ||
<Menu.Item | ||
as="button" | ||
role="tab" | ||
id="my-communities-tab" | ||
aria-selected={!allCommunitiesSelected} | ||
aria-controls={appID} | ||
name="My communities" | ||
active={!allCommunitiesSelected} | ||
onClick={myCommunitiesOnClick} | ||
> | ||
{i18next.t("My communities")} | ||
</Menu.Item> | ||
</Menu> | ||
); | ||
} | ||
} | ||
|
||
CommunitiesStatusFilter.propTypes = { | ||
allCommunitiesOnClick: PropTypes.func.isRequired, | ||
myCommunitiesOnClick: PropTypes.func.isRequired, | ||
allCommunitiesSelected: PropTypes.bool, | ||
appID: PropTypes.string.isRequired, | ||
}; | ||
|
||
CommunitiesStatusFilter.defaultProps = { | ||
allCommunitiesSelected: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters