mirror of
https://github.com/strapi/strapi.git
synced 2025-08-26 17:53:10 +00:00
Simplified the object needed for InputDescription and InputErros message
This commit is contained in:
parent
ced682764a
commit
dc4e380787
@ -534,10 +534,8 @@ Component integrates Label, InputText, InputDescription and InputErrors.
|
||||
render() {
|
||||
const { didCheckErrors, errors, foo } = this.state;
|
||||
const inputDescription = {
|
||||
message: {
|
||||
id: 'my-plugin.inputFoo.description',
|
||||
params: { bar: 'Something' }
|
||||
}
|
||||
params: { bar: 'Something' },
|
||||
};
|
||||
|
||||
// This can also works (it's the same behavior for the label)
|
||||
@ -555,10 +553,10 @@ Component integrates Label, InputText, InputDescription and InputErrors.
|
||||
inputDescription={inputDescription}
|
||||
name="foo"
|
||||
onChange={this.handleChange}
|
||||
label={{ message: {
|
||||
label={{
|
||||
id: 'my-plugin.inputFoo.label',
|
||||
params: { name: <a href="strapi.io" target="_blank">Click me</a> }
|
||||
}}}
|
||||
}}
|
||||
value={foo}
|
||||
validations={{ required: true }}
|
||||
/>
|
||||
|
@ -83,7 +83,7 @@ class InputNumberWithErrors extends React.Component { // eslint-disable-line rea
|
||||
<Label
|
||||
className={labelClassName}
|
||||
htmlFor={name}
|
||||
message={this.props.label && this.props.label.message || this.props.label}
|
||||
message={this.props.label}
|
||||
style={labelStyle}
|
||||
/>
|
||||
<InputNumber
|
||||
@ -103,7 +103,7 @@ class InputNumberWithErrors extends React.Component { // eslint-disable-line rea
|
||||
/>
|
||||
<InputDescription
|
||||
className={inputDescriptionClassName}
|
||||
message={this.props.inputDescription && this.props.inputDescription.message || this.props.inputDescription}
|
||||
message={this.props.inputDescription}
|
||||
style={inputDescriptionStyle}
|
||||
/>
|
||||
<InputErrors
|
||||
@ -200,11 +200,9 @@ InputNumberWithErrors.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({
|
||||
message: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
params: PropTypes.object,
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
inputDescriptionClassName: PropTypes.string,
|
||||
inputDescriptionStyle: PropTypes.object,
|
||||
@ -213,11 +211,9 @@ InputNumberWithErrors.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({
|
||||
message: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
params: PropTypes.object,
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
labelClassName: PropTypes.string,
|
||||
labelStyle: PropTypes.object,
|
||||
|
@ -83,7 +83,7 @@ class InputTextWithErrors extends React.Component { // eslint-disable-line react
|
||||
<Label
|
||||
className={labelClassName}
|
||||
htmlFor={name}
|
||||
message={this.props.label && this.props.label.message || this.props.label}
|
||||
message={this.props.label}
|
||||
style={labelStyle}
|
||||
/>
|
||||
<InputText
|
||||
@ -103,7 +103,7 @@ class InputTextWithErrors extends React.Component { // eslint-disable-line react
|
||||
/>
|
||||
<InputDescription
|
||||
className={inputDescriptionClassName}
|
||||
message={this.props.inputDescription && this.props.inputDescription.message || this.props.inputDescription}
|
||||
message={this.props.inputDescription}
|
||||
style={inputDescriptionStyle}
|
||||
/>
|
||||
<InputErrors
|
||||
@ -199,11 +199,9 @@ InputTextWithErrors.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({
|
||||
message: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
params: PropTypes.object,
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
inputDescriptionClassName: PropTypes.string,
|
||||
inputDescriptionStyle: PropTypes.object,
|
||||
@ -212,11 +210,9 @@ InputTextWithErrors.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({
|
||||
message: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
params: PropTypes.object,
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
labelClassName: PropTypes.string,
|
||||
labelStyle: PropTypes.object,
|
||||
|
@ -72,7 +72,7 @@ class InputToggleWithErrors extends React.Component {
|
||||
<Label
|
||||
className={cn(!isEmpty(labelClassName) && labelClassName)}
|
||||
htmlFor={name}
|
||||
message={label && label.message || label}
|
||||
message={label}
|
||||
style={labelStyle}
|
||||
/>
|
||||
</div>
|
||||
@ -90,7 +90,7 @@ class InputToggleWithErrors extends React.Component {
|
||||
/>
|
||||
<InputDescription
|
||||
className={inputDescriptionClassName}
|
||||
message={inputDescription && inputDescription.message || inputDescription}
|
||||
message={inputDescription}
|
||||
style={inputDescriptionStyle}
|
||||
/>
|
||||
<InputErrors
|
||||
@ -141,11 +141,9 @@ InputToggleWithErrors.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.func,
|
||||
PropTypes.shape({
|
||||
message: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
params: PropTypes.object,
|
||||
}),
|
||||
}),
|
||||
]),
|
||||
inputDescriptionClassName: PropTypes.string,
|
||||
inputDescriptionStyle: PropTypes.object,
|
||||
|
Loading…
x
Reference in New Issue
Block a user