Skip to content

Commit

Permalink
fix(input field): render icon correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jgroth authored and adrianschmidt committed Sep 10, 2019
1 parent 5812f64 commit cbcc84b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/components/input-field/input-field.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ menu: Components
path="input-field"
name="limel-example-input-field-autocomplete"
/>

### Input field with icon action

<limel-example
path="input-field"
name="limel-example-input-field-icon"
/>
5 changes: 5 additions & 0 deletions src/components/input-field/input-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ $mdc-text-field-fullwidth-bottom-line-color: $lime-text-field-bottom-line-color;
.mdc-list-item {
cursor: pointer;
}

.mdc-text-field__icon {
width: 2.4rem;
height: 2.4rem;
}
9 changes: 3 additions & 6 deletions src/components/input-field/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ export class InputField {
public value: string;

/**
* This property just shows its value on the right side of the field
* at this moment. As soon as we have integrated a icon library it's
* supposed to match with an icon and display that
* Trailing icon to show to the far right in the field
*/
@Prop({ reflectToAttr: true })
public trailingIcon: string;
Expand Down Expand Up @@ -108,8 +106,7 @@ export class InputField {
private change: EventEmitter;

/**
* This event is tied to the `trailingIcon` property, which doesn't work
* at the moment. Don't use it.
* Emitted when the `trailingIcon` is set and the icon is interacted with
*/
@Event()
private action: EventEmitter;
Expand Down Expand Up @@ -191,7 +188,7 @@ export class InputField {
tabindex="0"
role="button"
>
{this.trailingIcon}
<limel-icon name={this.trailingIcon} />
</i>
);
}
Expand Down
27 changes: 27 additions & 0 deletions src/examples/input-field/input-field-icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Component, State } from '@stencil/core';

@Component({
tag: 'limel-example-input-field-icon',
shadow: true,
})
export class InputFieldIconExample {
@State()
private value;

public render() {
return (
<limel-input-field
label="Email address"
type="email"
value={this.value}
trailingIcon="filled_message"
onChange={event => {
this.value = event.detail;
}}
onAction={() => {
console.log(`sending email to ${this.value}`);
}}
/>
);
}
}

0 comments on commit cbcc84b

Please sign in to comment.