Add component input-textarea
This commit is contained in:
parent
c49f0099d9
commit
f2bb3eb7f3
5 changed files with 42 additions and 5 deletions
|
|
@ -21,5 +21,3 @@
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{yield}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { guidFor } from '@ember/object/internals';
|
||||
import { action } from '@ember/object';
|
||||
// import { tracked } from '@glimmer/tracking';
|
||||
|
||||
export default class InputTextComponent extends Component {
|
||||
get guid() {
|
||||
|
|
|
|||
22
app/components/input-textarea.hbs
Normal file
22
app/components/input-textarea.hbs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<div class="mb-4">
|
||||
{{#if @label}}
|
||||
<label for={{this.id}} class="block font-medium mb-1 text-dark">{{@label}}</label>
|
||||
{{/if}}
|
||||
<div class="relative flex items-center border rounded-md border-light">
|
||||
{{#if @prefixIcon}}
|
||||
<MdIcon
|
||||
@icon={{@prefixIcon}}
|
||||
class="h-8 w-8 pl-2 text-light"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
<textarea
|
||||
type="text"
|
||||
name={{@name}}
|
||||
id={{this.id}}
|
||||
class="block w-full p-2 bg-transparent focus:outline-none"
|
||||
placeholder={{@placeholder}}
|
||||
{{on 'input' this.onChange}}
|
||||
>{{@value}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
20
app/components/input-textarea.js
Normal file
20
app/components/input-textarea.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { guidFor } from '@ember/object/internals';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class InputTextareaComponent extends Component {
|
||||
get guid() {
|
||||
return guidFor(this);
|
||||
}
|
||||
|
||||
get id() {
|
||||
return this.args.id ?? this.guid;
|
||||
}
|
||||
|
||||
@action
|
||||
onChange(event) {
|
||||
if (this.args.onChange) {
|
||||
this.args.onChange(event.target.value, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,8 +15,6 @@
|
|||
</div>
|
||||
|
||||
{{#if (gt @model.nbHits 0)}}
|
||||
{{log @model}}
|
||||
|
||||
<div class="mb-4">
|
||||
<h2 class="text-xl mb-4">Results:</h2>
|
||||
<div class=" ">
|
||||
|
|
|
|||
Loading…
Reference in a new issue