import React, { Fragment } from 'react'; import { BaseDataEntryProps } from './data-entry'; import { DataTitleCopyable } from './data-title'; import './numeric-data-entry-with-formatted-link.css'; import { FieldRow } from './field-row'; interface NumericDataEntryWithFormattedLinkProps extends BaseDataEntryProps { value?: string; placeholder?: string; step?: number; min?: number; max?: number; linkTargetFunction: (val: string) => string; linkDescriptionFunction: (val: string) => string; } const NumericDataEntryWithFormattedLink: React.FunctionComponent = (props) => { const slugWithModifier = props.slug + (props.slugModifier ?? ''); return ( props.onChange( props.slug, e.target.value === '' ? null : parseFloat(e.target.value) ) } />
{props.value == undefined ?
: {props.linkDescriptionFunction(props.value)}}
); }; export default NumericDataEntryWithFormattedLink;