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

fix: filter bar position (DHIS2-9453) #1073

Merged
merged 3 commits into from
Sep 21, 2020
Merged
Changes from 2 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
11 changes: 3 additions & 8 deletions src/components/FilterBar/FilterBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import PropTypes from 'prop-types'
import FilterBadge from './FilterBadge'

import { sGetNamedItemFilters } from '../../reducers/itemFilters'
import { sGetControlBarUserRows } from '../../reducers/controlBar'
import { getControlBarHeight } from '../ControlBar/controlBarDimensions'
import { acRemoveItemFilter } from '../../actions/itemFilters'
import { acSetActiveModalDimension } from '../../actions/activeModalDimension'

Expand All @@ -25,12 +23,11 @@ export class FilterBar extends Component {
}

render() {
const { filters, userRows } = this.props

const top = getControlBarHeight(userRows) + 10
const { filters } = this.props

return filters.length ? (
<div className={classes.bar} style={{ top }}>
// the 3 is calculated so that the FilterBar has the same vertical position as the TitleBar in relation to the ControlBar
<div className={classes.bar} style={{ top: 3 }}>
{filters.map(filter => (
<FilterBadge
key={filter.id}
Expand All @@ -48,7 +45,6 @@ FilterBar.propTypes = {
filters: PropTypes.array.isRequired,
removeItemFilter: PropTypes.func.isRequired,
setActiveModalDimension: PropTypes.func,
userRows: PropTypes.number,
}

FilterBar.defaultProps = {
Expand All @@ -58,7 +54,6 @@ FilterBar.defaultProps = {

const mapStateToProps = state => ({
filters: sGetNamedItemFilters(state),
userRows: sGetControlBarUserRows(state),
})

export default connect(mapStateToProps, {
Expand Down