Hide copy link only when field is disabled

This commit is contained in:
Tom Russell 2019-05-27 20:54:43 +01:00
parent 51ef47e50a
commit 04d50a9181
2 changed files with 11 additions and 7 deletions

View File

@ -285,7 +285,7 @@ EditForm.propTypes = {
const TextInput = (props) => ( const TextInput = (props) => (
<Fragment> <Fragment>
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} <Label slug={props.slug} title={props.title} tooltip={props.tooltip}
cat={props.cat} cat={props.cat} disabled={props.disabled}
value={props.value || ''} value={props.value || ''}
/> />
<input className="form-control" type="text" <input className="form-control" type="text"
@ -313,7 +313,8 @@ TextInput.propTypes = {
const LongTextInput = (props) => ( const LongTextInput = (props) => (
<Fragment> <Fragment>
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} /> <Label slug={props.slug} title={props.title} cat={props.cat}
disabled={props.disabled} tooltip={props.tooltip} />
<textarea className="form-control" <textarea className="form-control"
id={props.slug} name={props.slug} id={props.slug} name={props.slug}
disabled={props.disabled} disabled={props.disabled}
@ -414,7 +415,7 @@ MultiTextInput.propTypes = {
const TextListInput = (props) => ( const TextListInput = (props) => (
<Fragment> <Fragment>
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} <Label slug={props.slug} title={props.title} tooltip={props.tooltip}
cat={props.cat} cat={props.cat} disabled={props.disabled}
value={props.value || ''} value={props.value || ''}
/> />
<select className="form-control" <select className="form-control"
@ -447,7 +448,7 @@ TextListInput.propTypes = {
const NumberInput = (props) => ( const NumberInput = (props) => (
<Fragment> <Fragment>
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} <Label slug={props.slug} title={props.title} tooltip={props.tooltip}
cat={props.cat} cat={props.cat} disabled={props.disabled}
value={props.value || ''} value={props.value || ''}
/> />
<input className="form-control" type="number" step={props.step} <input className="form-control" type="number" step={props.step}
@ -565,7 +566,7 @@ const Label = (props) => (
<label htmlFor={props.slug}> <label htmlFor={props.slug}>
{props.title} {props.title}
{ props.tooltip? <Tooltip text={ props.tooltip } /> : null } { props.tooltip? <Tooltip text={ props.tooltip } /> : null }
{ (props.cat && props.slug && props.value)? { (props.cat && props.slug && !props.disabled)?
<div className="icon-buttons"> <div className="icon-buttons">
<NavLink <NavLink
to={`/multi-edit/${props.cat}.html?k=${props.slug}&v=${props.value}`} to={`/multi-edit/${props.cat}.html?k=${props.slug}&v=${props.value}`}
@ -582,6 +583,7 @@ Label.propTypes = {
cat: PropTypes.string, cat: PropTypes.string,
value: PropTypes.any, value: PropTypes.any,
title: PropTypes.string, title: PropTypes.string,
disabled: PropTypes.bool,
tooltip: PropTypes.string tooltip: PropTypes.string
} }

View File

@ -139,14 +139,15 @@ const DataEntry = (props) => (
<dt> <dt>
{ props.title } { props.title }
{ props.tooltip? <Tooltip text={ props.tooltip } /> : null } { props.tooltip? <Tooltip text={ props.tooltip } /> : null }
{ (props.cat && props.slug && props.value)? { (props.cat && props.slug && !props.disabled)?
<div className="icon-buttons"> <div className="icon-buttons">
<NavLink <NavLink
to={`/multi-edit/${props.cat}.html?k=${props.slug}&v=${props.value}`} to={`/multi-edit/${props.cat}.html?k=${props.slug}&v=${props.value}`}
className="icon-button copy"> className="icon-button copy">
Copy Copy
</NavLink> </NavLink>
</div> : null </div>
: null
} }
</dt> </dt>
<dd>{ <dd>{
@ -163,6 +164,7 @@ DataEntry.propTypes = {
cat: PropTypes.string, cat: PropTypes.string,
slug: PropTypes.string, slug: PropTypes.string,
tooltip: PropTypes.string, tooltip: PropTypes.string,
disabled: PropTypes.bool,
value: PropTypes.any value: PropTypes.any
} }