Skip to content

Commit

Permalink
Merge pull request #507 from Infineon/310-design-review-component-sea…
Browse files Browse the repository at this point in the history
…rch-bar

search-bar design review updates implemented
  • Loading branch information
tishoyanchev authored Sep 12, 2023
2 parents 3d05977 + 2c5c221 commit f76c32a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion packages/components-vue/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ export const IfxRadioButton = /*@__PURE__*/ defineContainer<JSX.IfxRadioButton>(


export const IfxSearchBar = /*@__PURE__*/ defineContainer<JSX.IfxSearchBar, JSX.IfxSearchBar["value"]>('ifx-search-bar', undefined, [
'showCloseButton',
'isOpen',
'disabled',
'value',
Expand Down
11 changes: 5 additions & 6 deletions packages/components/src/components/search-bar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

## Properties

| Property | Attribute | Description | Type | Default |
| ----------------- | ------------------- | ----------- | --------- | ----------- |
| `disabled` | `disabled` | | `boolean` | `false` |
| `isOpen` | `is-open` | | `boolean` | `true` |
| `showCloseButton` | `show-close-button` | | `boolean` | `true` |
| `value` | `value` | | `string` | `undefined` |
| Property | Attribute | Description | Type | Default |
| ---------- | ---------- | ----------- | --------- | ----------- |
| `disabled` | `disabled` | | `boolean` | `false` |
| `isOpen` | `is-open` | | `boolean` | `true` |
| `value` | `value` | | `string` | `undefined` |


## Events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export default {
tags: ['autodocs'],

args: {
showCloseButton: true,
disabled: false,

},
Expand All @@ -20,19 +19,16 @@ export default {
detail: 'React: onIfxInput={handleInput}\nVue:@ifxInput="handleInput"\nAngular:(ifxInput)="handleInput()"\nVanillaJs:.addEventListener("ifxInput", (event) => {//handle input});',
},
},
}, showCloseButton: {
control: { type: 'boolean' },
},
},
};



const DefaultTemplate = ({ isOpen, showCloseButton, disabled }) => {
const DefaultTemplate = ({ isOpen, disabled }) => {
const element = document.createElement('ifx-search-bar');
element.setAttribute('is-open', isOpen);
element.setAttribute('disabled', disabled);
element.setAttribute('show-close-button', showCloseButton);
element.addEventListener('ifxInput', action('ifxInput'));

return element;
Expand Down
7 changes: 3 additions & 4 deletions packages/components/src/components/search-bar/search-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { Component, h, Prop, Event, EventEmitter, State, Watch } from '@stencil/
shadow: true,
})
export class SearchBar {
@Prop() showCloseButton: boolean = true;
@Prop() isOpen: boolean = true;
@Prop() disabled: boolean = false;
@State() internalState: boolean;
@Prop({ mutable: true }) value: string;
@Event() ifxInput: EventEmitter;
@Event() ifxSearchBarIsOpen: EventEmitter;


@Watch('isOpen')
handlePropChange() {
Expand Down Expand Up @@ -51,8 +50,8 @@ export class SearchBar {
<ifx-search-field disabled={this.disabled} value={this.value} onIfxInput={this.handleInput.bind(this)}>
<ifx-icon icon="search-16" slot="search-icon"></ifx-icon>
</ifx-search-field>
{this.showCloseButton &&
<a href='javascript:void(0)' onClick={this.handleCloseButton}>Close</a>}

<a href='javascript:void(0)' onClick={this.handleCloseButton}>Close</a>
</div>
) : (
<div class="search-bar__icon-wrapper" onClick={this.handleCloseButton}>
Expand Down

0 comments on commit f76c32a

Please sign in to comment.