Skip to content

Commit c2ec80b

Browse files
committed
Allow to adjust prompt styling
1 parent 701505d commit c2ec80b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@webscopeio/react-console",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "React component that emulates console behaviour",
55
"author": "jvorcak",
66
"license": "MIT",

src/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type Props = {
1313
welcomeMessage?: string,
1414
autoFocus: boolean,
1515
noCommandFound: (str: string) => Promise<string>,
16+
promptClassName?: string,
1617
}
1718

1819
type State = {
@@ -106,8 +107,13 @@ export default class ReactConsole extends React.Component<Props, State> {
106107
const {
107108
prompt,
108109
autoFocus,
110+
promptClassName,
109111
} = this.props;
110112

113+
const promptClass = promptClassName
114+
? `${styles.prompt} ${promptClassName}`
115+
: styles.prompt;
116+
111117
return (
112118
<div className={styles.wrapper} onClick={this.focusConsole} ref={ref => this.wrapperRef = ref}>
113119
<div>
@@ -123,7 +129,9 @@ export default class ReactConsole extends React.Component<Props, State> {
123129
onSubmit={this.onSubmit}
124130
>
125131
<div className={styles.promptWrapper}>
126-
<span className={styles.prompt}>{prompt}&nbsp;</span>
132+
<span
133+
className={promptClass}
134+
>{prompt}&nbsp;</span>
127135
<input
128136
disabled={this.state.commandInProgress}
129137
ref={ref => this.inputRef = ref}

0 commit comments

Comments
 (0)