DonationReceipt.tsx
5 months ago
DonationSummaryItems.tsx
1 year ago
FieldDescription.tsx
2 years ago
FieldError.tsx
2 years ago
FieldLabel.tsx
2 years ago
Form.tsx
2 years ago
FormError.tsx
1 year ago
Goal.tsx
1 year ago
GoalAchieved.tsx
2 years ago
Header.tsx
2 years ago
HeaderDescription.tsx
1 year ago
HeaderImage.tsx
2 years ago
HeaderTitle.tsx
2 years ago
MultiStepForm.tsx
2 years ago
NodeWrapper.tsx
2 years ago
Section.tsx
1 year ago
FieldError.tsx
19 lines
| 1 | import type {FieldErrorProps} from '@givewp/forms/propTypes'; |
| 2 | |
| 3 | /** |
| 4 | * Conditionally renders a field's error message if a message is present. |
| 5 | * |
| 6 | * @since 3.0.0 |
| 7 | */ |
| 8 | export default function FieldError({error, name}: FieldErrorProps) { |
| 9 | if (!error) { |
| 10 | return null; |
| 11 | } |
| 12 | |
| 13 | return ( |
| 14 | <div id={`givewp-field-error-${name}`} className="givewp-field-error-message" role="alert"> |
| 15 | <p>{error}</p> |
| 16 | </div> |
| 17 | ); |
| 18 | } |
| 19 |