Skip to content

Commit

Permalink
Make commands optional (elastic#9)
Browse files Browse the repository at this point in the history
* Make commands optional

* Adding back prop type for commands, sans isRequired
  • Loading branch information
ycombinator committed Nov 27, 2017
1 parent c02c45e commit 4948163
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ export function Instruction({ commands, paramValues, textPost, textPre }) {
post = <Content className="kuiVerticalRhythm" text={textPost}/>;
}

const aceOptions = {
fontSize: '14px',
maxLines: commands.length
};

return (
<div className="instruction">

{pre}

let commandsMarkup;
if (commands) {
const aceOptions = {
fontSize: '14px',
maxLines: commands.length
};
commandsMarkup = (
<div className="kuiVerticalRhythm">
<KuiCodeEditor
mode="sh"
Expand All @@ -39,15 +36,22 @@ export function Instruction({ commands, paramValues, textPost, textPre }) {
isReadOnly
/>
</div>
);
}

return (
<div className="instruction">

{pre}
{commandsMarkup}
{post}

</div>
);
}

Instruction.propTypes = {
commands: PropTypes.array.isRequired,
commands: PropTypes.array,
paramValues: PropTypes.object.isRequired,
textPost: PropTypes.string,
textPre: PropTypes.string,
Expand Down

0 comments on commit 4948163

Please sign in to comment.