Skip to content

Commit

Permalink
remove row height
Browse files Browse the repository at this point in the history
  • Loading branch information
vutran committed Dec 19, 2017
1 parent c1421fb commit b2eacb1
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -192,7 +192,6 @@ const VoiceBar = withVoice(Omnibar);
| `placeholder` | `string` | | Input placeholder |
| `maxResults` | `number` | | The maximum amount of results to display overall. |
| `maxViewableResults` | `number` | | The maximum amount of results to display in the viewable container (before scrolling). |
| `rowHeight` | `number` | | The height for each result row item |
| `resultStyle` | `object` | | Style object override for the result container |
| `onAction` | `Function` | | Apply an action callback when an item is executed. Arguments: `item` |
| `inputDelay` | `number` | | Set an input delay used for querying extensions (Default: 100ms) |
Expand Down
4 changes: 2 additions & 2 deletions src/Input.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
import { COLORS } from './constants';
import { COLORS, DEFAULT_HEIGHT } from './constants';

interface Props {
// callback method when the input value has changed
Expand All @@ -24,7 +24,7 @@ interface State {

const INPUT_STYLE: React.CSSProperties = {
width: '100%',
height: 50,
height: DEFAULT_HEIGHT,
fontSize: 24,
lineHeight: '24px',
boxSizing: 'border-box',
Expand Down
6 changes: 2 additions & 4 deletions src/Omnibar.tsx
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import Input from './Input';
import Results from './Results';
import search from './search';
import { KEYS, BLUR_DELAY } from './constants';
import { KEYS, BLUR_DELAY, DEFAULT_HEIGHT } from './constants';
import AnchorAction from './modifiers/anchor/AnchorAction';
import { debounce } from './utils';

Expand All @@ -15,7 +15,6 @@ export default class Omnibar<T> extends React.PureComponent<
children: null,
extensions: [],
maxViewableResults: null,
rowHeight: 50,
inputDelay: 100,

// style props
Expand Down Expand Up @@ -140,7 +139,7 @@ export default class Omnibar<T> extends React.PureComponent<

render() {
const maxHeight = this.props.maxViewableResults
? this.props.maxViewableResults * this.props.rowHeight
? this.props.maxViewableResults * DEFAULT_HEIGHT
: null;

return (
Expand All @@ -159,7 +158,6 @@ export default class Omnibar<T> extends React.PureComponent<
children: this.props.children,
selectedIndex: this.state.selectedIndex,
items: this.state.results,
rowHeight: this.props.rowHeight,
maxHeight: maxHeight,
style: this.props.resultStyle,
onMouseEnterItem: this.handleMouseEnterItem,
Expand Down
2 changes: 0 additions & 2 deletions src/Results.tsx
Expand Up @@ -21,8 +21,6 @@ interface Props<T> {
onClickItem?: (e: any /* Event */) => void;
// max container height
maxHeight?: React.CSSLength;
// item row height
rowHeight?: React.CSSLength;
// optional override container style
style?: React.CSSProperties;
}
Expand Down
6 changes: 3 additions & 3 deletions src/ResultsItem.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
import { COLORS } from './constants';
import { COLORS, DEFAULT_HEIGHT } from './constants';
import { AnchorItem } from './modifiers/anchor';
import AnchorRenderer from './modifiers/anchor/AnchorRenderer';

Expand All @@ -26,8 +26,8 @@ interface State {
}

const ITEM_STYLE: React.CSSProperties = {
height: 50,
lineHeight: '50px',
height: DEFAULT_HEIGHT,
lineHeight: `${DEFAULT_HEIGHT}px`,
fontSize: 24,
borderStyle: 'solid',
borderColor: COLORS.DARKGRAY,
Expand Down
2 changes: 2 additions & 0 deletions src/constants.tsx
Expand Up @@ -19,3 +19,5 @@ export const KEYS = {
};

export const BLUR_DELAY = 200;

export const DEFAULT_HEIGHT = 50;
3 changes: 2 additions & 1 deletion src/hoc.tsx
@@ -1,4 +1,5 @@
import * as React from 'react';
import { DEFAULT_HEIGHT } from './constants';
import Microphone from './Microphone';

/**
Expand Down Expand Up @@ -54,7 +55,7 @@ export function withVoice(Component: any): React.ComponentClass<any> {
top: 0,
border: 0,
backgroundColor: 'transparent',
lineHeight: '50px',
lineHeight: `${DEFAULT_HEIGHT}px`,
fontSize: 24,
paddingRight: 15,
paddingTop: 0,
Expand Down
2 changes: 0 additions & 2 deletions typings/index.d.ts
Expand Up @@ -40,8 +40,6 @@ declare namespace Omnibar {
maxViewableResults?: number;
// optional input placeholder text
placeholder?: string;
// optional result item height
rowHeight?: number;
// optional result list style override
resultStyle?: React.CSSProperties;
// options style on the root element
Expand Down

0 comments on commit b2eacb1

Please sign in to comment.