superdesk/superdesk-client-core

View on GitHub
scripts/apps/authoring-react/fields/duration/preview.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';
import {IDurationFieldConfig, IDurationValueOperational, IPreviewComponentProps} from 'superdesk-api';
import {getDurationString} from 'superdesk-ui-framework/react/components/DurationInput';

type IProps = IPreviewComponentProps<IDurationValueOperational, IDurationFieldConfig>;

export class Preview extends React.PureComponent<IProps> {
    render() {
        if (this.props.value == null) {
            return null;
        }

        return (
            <div>{getDurationString(this.props.value)}</div>
        );
    }
}