apple2js/js/ui/drive_lights.ts
Will Scullin c7a7bcd19b
Simple Preact download (#134)
* Simple Preact download
2022-06-19 09:01:44 -07:00

31 lines
1.0 KiB
TypeScript

import { Callbacks } from '../cards/disk2';
import type { DriveNumber } from '../formats/types';
export default class DriveLights implements Callbacks {
public driveLight(drive: DriveNumber, on: boolean) {
const disk = document.querySelector<HTMLElement>(`#disk${drive}`);
if (disk) {
disk.style.backgroundImage =
on ? 'url(css/red-on-16.png)' :
'url(css/red-off-16.png)';
}
}
public dirty(_drive: DriveNumber, _dirty: boolean) {
// document.querySelector('#disksave' + drive).disabled = !dirty;
}
public label(drive: DriveNumber, label?: string, side?: string) {
const labelElement = document.querySelector<HTMLElement>(`#disk-label${drive}`);
let labelText = '';
if (labelElement) {
labelText = labelElement.innerText;
if (label) {
labelText = `${label || ''} ${(side ? `- ${side}` : '')}`;
labelElement.innerText = labelText;
}
}
return labelText;
}
}