Skip to content

Commit

Permalink
Added support for disable on text-input component
Browse files Browse the repository at this point in the history
  • Loading branch information
ronitjadhav committed May 21, 2024
1 parent bb97c9e commit 4420fc5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
<gn-ui-text-input
class="w-20"
[value]="offset$ | async"
[extraClass]="
supportOffset ? '' : 'text-gray-600 bg-gray-200 opacity-70'
"
[disabled]="!supportOffset"
(valueChange)="supportOffset ? setOffset($event) : null"
hint=""
>
Expand All @@ -64,10 +62,6 @@
</span>
</div>
</div>
<div
*ngIf="!supportOffset"
class="absolute inset-0 bg-transparent cursor-not-allowed"
></div>
</div>
<div class="flex flex-col gap-3">
<p class="text-sm" translate>record.metadata.api.form.type</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
[placeholder]="hint"
[attr.aria-label]="hint"
[attr.required]="required || null"
[disabled]="disabled"
/>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const Primary: StoryObj<TextInputComponent> = {
value: '',
hint: 'Put something here!',
required: false,
disabled: false,
},
argTypes: {
valueChange: {
Expand Down
1 change: 1 addition & 0 deletions libs/ui/inputs/src/lib/text-input/text-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class TextInputComponent implements AfterViewInit {
@Input() extraClass = ''
@Input() hint: string
@Input() required = false
@Input() disabled: boolean
rawChange = new Subject<string>()
@Output() valueChange = this.rawChange.pipe(distinctUntilChanged())
@ViewChild('input') input
Expand Down

0 comments on commit 4420fc5

Please sign in to comment.