Skip to content

Commit 719b31f

Browse files
feat(input-with-copy): add node for settings button (#3267)
* feat(input-with-copy): add node for settings button * fix(input-with-copy): pr comments * chore(input-with-copy): change order of props Co-authored-by: Trevor <7311041+tjuanitas@users.noreply.github.com> * chore(input-with-copy): change description for property --------- Co-authored-by: Trevor <7311041+tjuanitas@users.noreply.github.com>
1 parent 3e80a06 commit 719b31f

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/components/text-input-with-copy-button/TextInputWithCopyButton.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const defaultCopyText = <FormattedMessage {...messages.copy} />;
1616
const defaultCopiedText = <FormattedMessage {...messages.copied} />;
1717

1818
type Props = {
19+
/** Array of nodes for additional buttons */
20+
additionalButtons?: Array<React.Node>,
1921
/** Set the focus to input when component loads */
2022
autofocus?: boolean,
2123
/** Default copy button text */
@@ -186,7 +188,7 @@ class TextInputWithCopyButton extends React.PureComponent<Props, State> {
186188
) : null;
187189

188190
render() {
189-
const { className, ...rest } = this.props;
191+
const { additionalButtons, className, ...rest } = this.props;
190192
const { copySuccess } = this.state;
191193
const { isCopyCommandSupported } = this;
192194

@@ -216,6 +218,7 @@ class TextInputWithCopyButton extends React.PureComponent<Props, State> {
216218
return (
217219
<div className={wrapperClasses} {...copyEvent}>
218220
<TextInput {...inputProps} onFocus={this.handleFocus} />
221+
{additionalButtons}
219222
{this.renderCopyButton()}
220223
</div>
221224
);

src/components/text-input-with-copy-button/TextInputWithCopyButton.scss

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@
1919

2020
.bdl-Button,
2121
.btn {
22+
margin: 0;
23+
border-left: 0;
24+
border-radius: 0;
25+
transition: background-color .5s ease, border-color .5s ease;
26+
}
27+
28+
.bdl-Button:last-child,
29+
.btn:last-child {
2230
min-width: 80px;
2331
margin: 0;
2432
border-left: 0;
25-
border-top-left-radius: 0;
26-
border-bottom-left-radius: 0;
33+
border-radius: 0 6px 6px 0;
2734
transition: background-color .5s ease, border-color .5s ease;
2835
}
2936

3037
&.copy-success {
31-
.btn,
32-
.btn:hover,
33-
.btn:active,
34-
.btn:active:hover {
38+
.btn:last-child,
39+
.btn:last-child:hover,
40+
.btn:last-child:active {
3541
color: $white;
3642
background-color: $bdl-green-light;
3743
border-color: $bdl-green-light;

0 commit comments

Comments
 (0)