Filter
Summary: _typescript_ Reviewed By: jknoxville Differential Revision: D16807179 fbshipit-source-id: b5de66d686394acba6552de139764bb65b3ac652
This commit is contained in:
committed by
Facebook Github Bot
parent
1deb3c68f9
commit
c8c90ee413
@@ -21,6 +21,7 @@ type Props = {
|
||||
children: React.ReactNode;
|
||||
/** The component that is used to wrap the children. Defaults to `FlexColumn`. */
|
||||
component: React.ComponentType<any> | string;
|
||||
onMouseDown: (e: React.MouseEvent) => any;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {Filter} from './types.js';
|
||||
import {PureComponent} from 'react';
|
||||
import ContextMenu from '../ContextMenu.tsx';
|
||||
import textContent from '../../../utils/textContent.tsx';
|
||||
import styled from '../../styled/index.js';
|
||||
import {colors} from '../colors.tsx';
|
||||
import {Filter} from './types.js';
|
||||
import React, {PureComponent} from 'react';
|
||||
import ContextMenu from '../ContextMenu';
|
||||
import textContent from '../../../utils/textContent';
|
||||
import styled from 'react-emotion';
|
||||
import {colors} from '../colors';
|
||||
|
||||
const FilterText = styled('div')({
|
||||
display: 'flex',
|
||||
@@ -40,13 +40,13 @@ const FilterText = styled('div')({
|
||||
});
|
||||
|
||||
type Props = {
|
||||
children: React.Node,
|
||||
addFilter: (filter: Filter) => void,
|
||||
filterKey: string,
|
||||
children: React.ReactNode;
|
||||
addFilter: (filter: Filter) => void;
|
||||
filterKey: string;
|
||||
};
|
||||
|
||||
export default class FilterRow extends PureComponent<Props> {
|
||||
onClick = (e: SyntheticMouseEvent<>) => {
|
||||
onClick = (e: React.MouseEvent) => {
|
||||
if (e.button === 0) {
|
||||
this.props.addFilter({
|
||||
type: e.metaKey || e.altKey ? 'exclude' : 'include',
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type Filter =
|
||||
| {
|
||||
key: string,
|
||||
value: string,
|
||||
type: 'include' | 'exclude',
|
||||
}
|
||||
| {
|
||||
key: string,
|
||||
value: Array<string>,
|
||||
type: 'enum',
|
||||
enum: Array<{
|
||||
label: string,
|
||||
color?: string,
|
||||
value: string,
|
||||
}>,
|
||||
persistent?: boolean,
|
||||
};
|
||||
24
src/ui/components/filter/types.tsx
Normal file
24
src/ui/components/filter/types.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
|
||||
export type Filter =
|
||||
| {
|
||||
key: string;
|
||||
value: string;
|
||||
type: 'include' | 'exclude';
|
||||
}
|
||||
| {
|
||||
key: string;
|
||||
value: Array<string>;
|
||||
type: 'enum';
|
||||
enum: Array<{
|
||||
label: string;
|
||||
color?: string;
|
||||
value: string;
|
||||
}>;
|
||||
persistent?: boolean;
|
||||
};
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
} from './types.js';
|
||||
|
||||
import React from 'react';
|
||||
import FilterRow from '../filter/FilterRow.js';
|
||||
import FilterRow from '../filter/FilterRow.tsx';
|
||||
import styled from '../../styled/index.js';
|
||||
import FlexRow from '../FlexRow.tsx';
|
||||
import {colors} from '../colors.tsx';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {Filter} from '../filter/types.js';
|
||||
import type {Filter} from '../filter/types.tsx';
|
||||
|
||||
import {List} from 'immutable';
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ export {default as Label} from './components/Label.tsx';
|
||||
export {default as Heading} from './components/Heading.tsx';
|
||||
|
||||
// filters
|
||||
export type {Filter} from './components/filter/types.js';
|
||||
export type {Filter} from './components/filter/types.tsx';
|
||||
|
||||
export {default as MarkerTimeline} from './components/MarkerTimeline.tsx';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user