blob: 540c1b5e160ab91713895a6109ac2df703e77c2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
import { action, observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { DocumentType } from '../../documents/DocumentTypes';
import './IconBar.scss';
import { IconButton } from './IconButton';
import './IconButton.scss';
export interface IconBarProps {
setIcons: (icons: string[]) => void;
}
@observer
export class IconBar extends React.Component<IconBarProps> {
public _allIcons: string[] = [DocumentType.AUDIO, DocumentType.COL, DocumentType.IMG, DocumentType.LINK, DocumentType.PDF, DocumentType.RTF, DocumentType.VID, DocumentType.WEB, DocumentType.MAP];
@observable private _icons: string[] = this._allIcons;
static Instance: IconBar;
@observable public _resetClicked: boolean = false;
@observable public _selectAllClicked: boolean = false;
@observable public _reset: number = 0;
@observable public _select: number = 0;
@action.bound
updateIcon(newArray: string[]) {
this._icons = newArray;
this.props.setIcons?.(this._icons);
}
@action.bound
getIcons(): string[] {
return this._icons;
}
constructor(props: any) {
super(props);
IconBar.Instance = this;
}
@action.bound
getList(): string[] {
return this.getIcons();
}
@action.bound
updateList(newList: string[]) {
this.updateIcon(newList);
}
@action.bound
resetSelf = () => {
this._resetClicked = true;
this.updateList([]);
};
@action.bound
selectAll = () => {
this._selectAllClicked = true;
this.updateList(this._allIcons);
};
render() {
return (
<div className="icon-bar">
{this._allIcons.map((type: string) => (
<IconButton key={type.toString()} type={type} />
))}
</div>
);
}
}
|