Skip to content

Commit

Permalink
updated props in inputgroupaddon
Browse files Browse the repository at this point in the history
  • Loading branch information
hertweckhr1 committed Oct 11, 2019
1 parent d05d5c7 commit 44843f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 65 deletions.
33 changes: 19 additions & 14 deletions src/InputGroup/InputGroupAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,69 @@ import withStyles from '../utils/WithStyles/WithStyles';

const InputGroupAddon = ({
addon,
compact,
actions,
glyph,
addonClassNames,
children,
className,
disableStyles,
inputType,
numberDownCallback,
numberUpCallback,
localizedText,
numberDownButtonProps,
numberUpButtonProps,
onClick,
...props
...otherProps
}) => {

let returnObject = addon;

if (props.actions) {
if (actions) {
returnObject = children;
} else if (props.glyph) {
} else if (glyph) {
returnObject = (
<Icon
disableStyles={disableStyles}
glyph={props.glyph}
glyph={glyph}
role='presentation' />
);
}

const addonClasses = classnames(
addonClassNames,
'fd-input-group__addon',
[{ 'fd-input-group__addon--button': !!props.actions || props.inputType === 'number' }],
[{ 'fd-input-group__addon--button--compact': props.compact }],
[{ 'fd-input-group__addon--button': !!actions || inputType === 'number' }],
[{ 'fd-input-group__addon--button--compact': compact }],
);


if (props.inputType === 'number') {
if (inputType === 'number') {
return (
<span className={addonClasses}>
<span {...otherProps} className={addonClasses}>
<Button
{...numberUpButtonProps}
aria-label={localizedText.up}
className='fd-button--half fd-input-group__button'
compact={props.compact}
compact={compact}
disableStyles={disableStyles}
glyph='slim-arrow-up'
onClick={props.numberUpCallback}
onClick={numberUpCallback}
option='light' />
<Button
{...numberDownButtonProps}
aria-label={localizedText.down}
className='fd-button--half fd-input-group__button'
compact={props.compact}
compact={compact}
disableStyles={disableStyles}
glyph='slim-arrow-down'
onClick={props.numberDownCallback}
onClick={numberDownCallback}
option='light' />
</span>
);
} else {
return (
<span className={addonClasses} {...props} >
<span className={addonClasses} {...otherProps} >
{returnObject}
</span>
);
Expand Down
51 changes: 0 additions & 51 deletions src/InputGroup/__snapshots__/InputGroup.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ exports[`<InputGroup /> create input group items 1`] = `
>
<span
className="fd-input-group__addon"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
$
</span>
Expand All @@ -33,9 +30,6 @@ exports[`<InputGroup /> create input group items 2`] = `
/>
<span
className="fd-input-group__addon"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
</span>
Expand All @@ -48,10 +42,6 @@ exports[`<InputGroup /> create input group items 3`] = `
>
<span
className="fd-input-group__addon fd-input-group__addon--button--compact"
compact={true}
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
$
</span>
Expand All @@ -76,10 +66,6 @@ exports[`<InputGroup /> create input group items 4`] = `
/>
<span
className="fd-input-group__addon fd-input-group__addon--button--compact"
compact={true}
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
</span>
Expand Down Expand Up @@ -146,10 +132,6 @@ exports[`<InputGroup /> create input group items 7`] = `
>
<span
className="fd-input-group__addon"
glyph="globe"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<span
className="sap-icon--globe"
Expand All @@ -171,11 +153,6 @@ exports[`<InputGroup /> create input group items 8`] = `
>
<span
className="fd-input-group__addon fd-input-group__addon--button--compact"
compact={true}
glyph="globe"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<span
className="sap-icon--globe"
Expand Down Expand Up @@ -203,10 +180,6 @@ exports[`<InputGroup /> create input group items 9`] = `
/>
<span
className="fd-input-group__addon"
glyph="hide"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<span
className="sap-icon--hide"
Expand All @@ -228,11 +201,6 @@ exports[`<InputGroup /> create input group items 10`] = `
/>
<span
className="fd-input-group__addon fd-input-group__addon--button--compact"
compact={true}
glyph="hide"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<span
className="sap-icon--hide"
Expand All @@ -253,11 +221,7 @@ exports[`<InputGroup /> create input group items 11`] = `
value="1234567890"
/>
<span
actions={true}
className="fd-input-group__addon fd-input-group__addon--button"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<button
className="fd-button--light"
Expand All @@ -279,12 +243,7 @@ exports[`<InputGroup /> create input group items 12`] = `
value="1234567890"
/>
<span
actions={true}
className="fd-input-group__addon fd-input-group__addon--button fd-input-group__addon--button--compact"
compact={true}
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
<button
className="fd-button--light fd-button--compact"
Expand All @@ -300,11 +259,7 @@ exports[`<InputGroup /> create input group items 13`] = `
className="fd-input-group"
>
<span
actions={true}
className="fd-input-group__addon fd-input-group__addon--button"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
/>
<input
className="fd-input fd-input-group__input"
Expand Down Expand Up @@ -348,9 +303,6 @@ exports[`<InputGroup /> create input group items 15`] = `
>
<span
className="fd-input-group__addon"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
$
</span>
Expand All @@ -375,9 +327,6 @@ exports[`<InputGroup /> create input group items 16`] = `
/>
<span
className="fd-input-group__addon"
inputType="text"
numberDownCallback={[Function]}
numberUpCallback={[Function]}
>
</span>
Expand Down

0 comments on commit 44843f3

Please sign in to comment.