Details.tsx 990 Bytes
Newer Older
1
import * as React from 'react';
2
import { DetailsRow, IDetailsRowBaseProps } from '@fluentui/react';
3
import OpenRow from '../../public-child/OpenRow';
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

interface DetailsProps {
    detailsProps: IDetailsRowBaseProps;
}

interface DetailsState {
    isExpand: boolean;
}

class Details extends React.Component<DetailsProps, DetailsState> {
    constructor(props: DetailsProps) {
        super(props);
        this.state = { isExpand: false };
    }

    render(): React.ReactNode {
        const { detailsProps } = this.props;
        const { isExpand } = this.state;
        return (
            <div>
24
25
26
27
28
                <div
                    onClick={(): void => {
                        this.setState(() => ({ isExpand: !isExpand }));
                    }}
                >
29
30
31
32
33
34
35
36
                    <DetailsRow {...detailsProps} />
                </div>
                {isExpand && <OpenRow trialId={detailsProps.item.id} />}
            </div>
        );
    }
}

37
export default Details;