mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Improve frontend accessibility
In particular checkboxes, likes/dislikes, share button, video thumbnails and help buttons
This commit is contained in:
parent
4bdd9473fd
commit
0f7fedc398
22 changed files with 160 additions and 117 deletions
45
client/src/app/shared/forms/peertube-checkbox.component.ts
Normal file
45
client/src/app/shared/forms/peertube-checkbox.component.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { Component, forwardRef, Input } from '@angular/core'
|
||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
|
||||
@Component({
|
||||
selector: 'my-peertube-checkbox',
|
||||
styleUrls: [ './peertube-checkbox.component.scss' ],
|
||||
templateUrl: './peertube-checkbox.component.html',
|
||||
providers: [
|
||||
{
|
||||
provide: NG_VALUE_ACCESSOR,
|
||||
useExisting: forwardRef(() => PeertubeCheckboxComponent),
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
})
|
||||
export class PeertubeCheckboxComponent implements ControlValueAccessor {
|
||||
@Input() checked = false
|
||||
@Input() inputName: string
|
||||
@Input() labelText: string
|
||||
@Input() helpHtml: string
|
||||
|
||||
isDisabled = false
|
||||
|
||||
propagateChange = (_: any) => { /* empty */ }
|
||||
|
||||
writeValue (checked: boolean) {
|
||||
this.checked = checked
|
||||
}
|
||||
|
||||
registerOnChange (fn: (_: any) => void) {
|
||||
this.propagateChange = fn
|
||||
}
|
||||
|
||||
registerOnTouched () {
|
||||
// Unused
|
||||
}
|
||||
|
||||
onModelChange () {
|
||||
this.propagateChange(this.checked)
|
||||
}
|
||||
|
||||
setDisabledState (isDisabled: boolean) {
|
||||
this.isDisabled = isDisabled
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue