mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-17 18:26:17 +02:00
Mobile support for filter dialog
This commit is contained in:
parent
ea1835ca53
commit
96428c88f3
@ -48,13 +48,6 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
|
|
||||||
> .IconButton:first-child {
|
|
||||||
/* Hide close button on larger screens */
|
|
||||||
@media not screen and (max-width: 975px) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
> .content {
|
> .content {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -71,5 +64,12 @@
|
|||||||
> .content.fullwidth {
|
> .content.fullwidth {
|
||||||
padding: 10px 0 10px 0;
|
padding: 10px 0 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hideOnWidescreen {
|
||||||
|
/* Hide controls (e.g. close button) on larger screens */
|
||||||
|
@media not screen and (max-width: 975px) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ export default class Dialog extends React.PureComponent<Props> {
|
|||||||
onClick={this.closeClicked}
|
onClick={this.closeClicked}
|
||||||
icon={<CloseIcon/>}
|
icon={<CloseIcon/>}
|
||||||
title={'Close dialog'}
|
title={'Close dialog'}
|
||||||
|
className='hideOnWidescreen'
|
||||||
/>
|
/>
|
||||||
<div className='octo-spacer'/>
|
<div className='octo-spacer'/>
|
||||||
<MenuWrapper>
|
<MenuWrapper>
|
||||||
|
@ -9,6 +9,27 @@
|
|||||||
background-color: rgb(var(--main-bg));
|
background-color: rgb(var(--main-bg));
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
|
@media screen and (max-width: 420px) {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hideOnWidescreen {
|
||||||
|
/* Hide controls (e.g. close button) on larger screens */
|
||||||
|
@media not screen and (max-width: 420px) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
> .toolbar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
height: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
.octo-filterclause {
|
.octo-filterclause {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {FormattedMessage, IntlShape, injectIntl} from 'react-intl'
|
import {FormattedMessage, injectIntl, IntlShape} from 'react-intl'
|
||||||
|
|
||||||
import {IPropertyTemplate} from '../blocks/board'
|
import {IPropertyTemplate} from '../blocks/board'
|
||||||
|
|
||||||
import {BoardTree} from '../viewModel/boardTree'
|
|
||||||
import {FilterClause, FilterCondition} from '../filterClause'
|
import {FilterClause, FilterCondition} from '../filterClause'
|
||||||
import {FilterGroup} from '../filterGroup'
|
import {FilterGroup} from '../filterGroup'
|
||||||
import mutator from '../mutator'
|
import mutator from '../mutator'
|
||||||
import {Utils} from '../utils'
|
import {Utils} from '../utils'
|
||||||
|
import {BoardTree} from '../viewModel/boardTree'
|
||||||
import MenuWrapper from '../widgets/menuWrapper'
|
|
||||||
import Menu from '../widgets/menu'
|
|
||||||
import Button from '../widgets/buttons/button'
|
import Button from '../widgets/buttons/button'
|
||||||
|
import IconButton from '../widgets/buttons/iconButton'
|
||||||
|
import CloseIcon from '../widgets/icons/close'
|
||||||
|
import Menu from '../widgets/menu'
|
||||||
|
import MenuWrapper from '../widgets/menuWrapper'
|
||||||
import './filterComponent.scss'
|
import './filterComponent.scss'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -80,11 +79,18 @@ class FilterComponent extends React.Component<Props> {
|
|||||||
className='FilterComponent'
|
className='FilterComponent'
|
||||||
ref={this.node}
|
ref={this.node}
|
||||||
>
|
>
|
||||||
|
<div className='toolbar hideOnWidescreen'>
|
||||||
|
<IconButton
|
||||||
|
onClick={this.closeClicked}
|
||||||
|
icon={<CloseIcon/>}
|
||||||
|
title={'Close dialog'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{filters.map((filter) => {
|
{filters.map((filter) => {
|
||||||
const template = board.cardProperties.find((o) => o.id === filter.propertyId)
|
const template = board.cardProperties.find((o) => o.id === filter.propertyId)
|
||||||
const propertyName = template ? template.name : '(unknown)' // TODO: Handle error
|
const propertyName = template ? template.name : '(unknown)' // TODO: Handle error
|
||||||
const key = `${filter.propertyId}-${filter.condition}-${filter.values.join(',')}`
|
const key = `${filter.propertyId}-${filter.condition}-${filter.values.join(',')}`
|
||||||
Utils.log(`FilterClause key: ${key}`)
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='octo-filterclause'
|
className='octo-filterclause'
|
||||||
@ -213,6 +219,10 @@ class FilterComponent extends React.Component<Props> {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private closeClicked = () => {
|
||||||
|
this.props.onClose()
|
||||||
|
}
|
||||||
|
|
||||||
private deleteClicked(filter: FilterClause) {
|
private deleteClicked(filter: FilterClause) {
|
||||||
const {boardTree} = this.props
|
const {boardTree} = this.props
|
||||||
const {activeView: view} = boardTree
|
const {activeView: view} = boardTree
|
||||||
|
@ -65,11 +65,11 @@ class ViewHeader extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private filterClicked = () => {
|
private showFilterDialog = () => {
|
||||||
this.setState({showFilter: true})
|
this.setState({showFilter: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
private hideFilter = () => {
|
private hideFilterDialog = () => {
|
||||||
this.setState({showFilter: false})
|
this.setState({showFilter: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,18 +235,18 @@ class ViewHeader extends React.Component<Props, State> {
|
|||||||
<div className='filter-container'>
|
<div className='filter-container'>
|
||||||
<Button
|
<Button
|
||||||
active={hasFilter}
|
active={hasFilter}
|
||||||
onClick={this.filterClicked}
|
onClick={this.showFilterDialog}
|
||||||
>
|
>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='ViewHeader.filter'
|
id='ViewHeader.filter'
|
||||||
defaultMessage='Filter'
|
defaultMessage='Filter'
|
||||||
/>
|
/>
|
||||||
{this.state.showFilter &&
|
|
||||||
<FilterComponent
|
|
||||||
boardTree={boardTree}
|
|
||||||
onClose={this.hideFilter}
|
|
||||||
/>}
|
|
||||||
</Button>
|
</Button>
|
||||||
|
{this.state.showFilter &&
|
||||||
|
<FilterComponent
|
||||||
|
boardTree={boardTree}
|
||||||
|
onClose={this.hideFilterDialog}
|
||||||
|
/>}
|
||||||
</div>
|
</div>
|
||||||
<MenuWrapper>
|
<MenuWrapper>
|
||||||
<Button active={hasSort}>
|
<Button active={hasSort}>
|
||||||
|
@ -13,8 +13,8 @@ type Props = {
|
|||||||
active?: boolean
|
active?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Button extends React.Component<Props> {
|
export default class Button extends React.PureComponent<Props> {
|
||||||
render() {
|
render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={this.props.onClick}
|
onClick={this.props.onClick}
|
||||||
|
@ -8,14 +8,19 @@ type Props = {
|
|||||||
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
|
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void
|
||||||
title?: string
|
title?: string
|
||||||
icon?: React.ReactNode
|
icon?: React.ReactNode
|
||||||
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class IconButton extends React.PureComponent<Props> {
|
export default class IconButton extends React.PureComponent<Props> {
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
|
let className = 'Button IconButton'
|
||||||
|
if (this.props.className) {
|
||||||
|
className += ' ' + this.props.className
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={this.props.onClick}
|
onClick={this.props.onClick}
|
||||||
className='Button IconButton'
|
className={className}
|
||||||
title={this.props.title}
|
title={this.props.title}
|
||||||
>
|
>
|
||||||
{this.props.icon}
|
{this.props.icon}
|
||||||
|
Loading…
Reference in New Issue
Block a user