Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5593c10b

Přidáno uživatelem Dominik Poch před asi 2 roky(ů)

Connected tag panel to server

Zobrazit rozdíly:

webapp/components/annotation/SubTagItem.tsx
1
import { SubTagInfo } from '../../api';
1
import { SubTagInfo, TagInfo } from '../../api';
2 2
import { Container, Row } from 'react-bootstrap';
3 3
import { Button } from 'antd';
4
import { useContext } from 'react';
5
import { TagCategoryContext } from '../../contexts/TagCategoryContext';
4 6

  
5 7
/**
6 8
 * Creates a single tag item in a tag panel.
7 9
 * @param props Properties should contain the tag.
8 10
 * @returns The item that represents the tag.
9 11
 */
10
export function SubTagItem(props: { subTag: SubTagInfo }) {
12
export function SubTagItem(props: { tag: TagInfo; subTag: SubTagInfo }) {
13
    const { selectTag } = useContext(TagCategoryContext);
14

  
11 15
    /**
12 16
     * Selects the sub tag.
13 17
     */
14
    const selectSubTag = () => {};
18
    const onSelectSubTag = () => {
19
        selectTag(props.tag, props.subTag);
20
    };
15 21

  
16 22
    return (
17 23
        <Container>
18 24
            <Row>
19
                <Button type="text" onClick={selectSubTag} className="w-100 text-start">
25
                <Button type="text" onClick={onSelectSubTag} className="w-100 text-start">
20 26
                    {props.subTag.name}
21 27
                </Button>
22 28
            </Row>

Také k dispozici: Unified diff