Skip to content

Commit

Permalink
feat(Omnibar): add rootStyle (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
adnasa authored and vutran committed Nov 2, 2017
1 parent d9392f7 commit 11c6edd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 10 additions & 5 deletions src/Omnibar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ export default class Omnibar<T> extends React.PureComponent<
extensions: [],
maxViewableResults: null,
rowHeight: 50,
resultStyle: {},
inputDelay: 100,

// style props
resultStyle: {},
rootStyle: { position: 'relative' },
};

state: Omnibar.State<T> = {
Expand Down Expand Up @@ -141,20 +144,22 @@ export default class Omnibar<T> extends React.PureComponent<
defaultValue,
width,
height,
inputStyle,
rowHeight,
rowStyle,
resultStyle,
resultRenderer,
onAction,
// style props
inputStyle,
rootStyle,
rowStyle,
resultStyle,
} = this.props;

const maxHeight = maxViewableResults
? maxViewableResults * rowHeight
: null;

return (
<div style={{ position: 'relative' }}>
<div style={rootStyle}>
{React.createElement(Input, {
defaultValue,
width,
Expand Down
4 changes: 3 additions & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ declare namespace Omnibar {
// optional input bar height
height?: number;
// optional input bar style override
inputStyle?: React.CSSProperties
inputStyle?: React.CSSProperties;
// optional result item height
rowHeight?: number;
// optional result item style override
rowStyle?: React.CSSProperties;
// optional result list style override
resultStyle?: React.CSSProperties;
// options style on the root element
rootStyle?: React.CSSProperties;
// optional result renderering function
resultRenderer?: <T>(item: T) => React.ReactChild;
// optional action override
Expand Down

0 comments on commit 11c6edd

Please sign in to comment.