Projekt

Obecné

Profil

Stáhnout (2.13 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { Row } from 'react-bootstrap';
2
import { Occurrence, Tag } from '../models/tag';
3
import { useState } from 'react';
4

    
5
import 'antd/dist/antd.css';
6
import { Button } from 'antd';
7
import {
8
    PlusOutlined,
9
    EyeOutlined,
10
    DownOutlined,
11
    DeleteOutlined,
12
} from '@ant-design/icons';
13

    
14
function AnnotationItem(tag: Tag) {
15
    const [visibleProperties, setVisibleProperties] = useState(false);
16
    const [visible, setVisible] = useState(true);
17

    
18
    const addOccurrence = () => {};
19

    
20
    const deleteOccurrence = (occurrence: Occurrence) => (e: any) => {};
21

    
22
    const changeVisibility = () => {};
23

    
24
    const changePropertiesVisiblity = () => {
25
        setVisibleProperties(!visibleProperties);
26
    };
27

    
28
    return (
29
        <div>
30
            <Row>
31
                {tag.name}
32
                <Button
33
                    type="text"
34
                    shape="circle"
35
                    icon={<PlusOutlined />}
36
                    onClick={addOccurrence}
37
                />
38
                <Button
39
                    type="text"
40
                    shape="circle"
41
                    icon={<EyeOutlined />}
42
                    onClick={changeVisibility}
43
                />
44
                <Button
45
                    type="text"
46
                    shape="circle"
47
                    icon={<DownOutlined />}
48
                    onClick={changePropertiesVisiblity}
49
                />
50
            </Row>
51
            {visibleProperties && (
52
                <Row>
53
                    {tag.category}
54
                    Výskyty
55
                    {tag.occurrences.map((occurrence, index) => {
56
                        return (
57
                            <div key={index}>
58
                                {occurrence.position}
59
                                {occurrence.length}
60
                                <Button
61
                                    icon={<DeleteOutlined />}
62
                                    onClick={deleteOccurrence(occurrence)}
63
                                ></Button>
64
                            </div>
65
                        );
66
                    })}
67
                </Row>
68
            )}
69
        </div>
70
    );
71
}
72

    
73
export default AnnotationItem;
(1-1/4)