From 67f8832f25c75017b46dd00b4a22332a6fe428ad Mon Sep 17 00:00:00 2001 From: Chris Snyder Date: Thu, 7 Mar 2024 16:55:12 -0500 Subject: [PATCH] Introduce a DateField type and rename Date component Introduce a DateField type and rename Date component to follow the naming pattern used by all other JSS field components. Compare Date.tsx to Text.tsx, Image.tsx, Link.tsx, File.tsx, or RichText.tsx. The naming of the Date component is inconsistent with the other field components and it is missing the interface/type like the others have. --- .../sitecore-jss-react/src/components/Date.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/sitecore-jss-react/src/components/Date.tsx b/packages/sitecore-jss-react/src/components/Date.tsx index 3ec447496a..90c6480aeb 100644 --- a/packages/sitecore-jss-react/src/components/Date.tsx +++ b/packages/sitecore-jss-react/src/components/Date.tsx @@ -1,7 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -export interface DateFieldProps { +export interface DateField { + value?: string; + editable?: string; +} + +export interface DateProps { /** The date field data. */ [htmlAttributes: string]: unknown; field: { @@ -21,7 +26,7 @@ export interface DateFieldProps { render?: (date: Date | null) => React.ReactNode; } -export const DateField: React.FC = ({ +export const Date: React.FC = ({ field, tag, editable, @@ -58,7 +63,7 @@ export const DateField: React.FC = ({ } }; -DateField.propTypes = { +Date.propTypes = { field: PropTypes.shape({ value: PropTypes.string, editable: PropTypes.string, @@ -68,8 +73,8 @@ DateField.propTypes = { render: PropTypes.func, }; -DateField.defaultProps = { +Date.defaultProps = { editable: true, }; -DateField.displayName = 'Date'; +Date.displayName = 'Date';