You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance the existing <LabelValue /> component to dynamically format and display values based on their data type. The component should accept the following props:
The component should accept the following props:
value (optional): The data to be displayed.
type (required): The type of the data (string, number, date, or boolean).
label (optional): A label to display alongside the value.
path (optional): The path in the data object (from DB) where the value can be found.
decimalPlaces (optional, default: 1): The number of decimal places to use when formatting numeric values.
prefix (optional): A string to prepend to the value (e.g., a currency symbol).
suffix (optional): A string to append to the value (e.g., a percentage symbol).
The component should handle various data types such as strings, numbers, dates, and booleans, and render them appropriately (e.g., numbers with decimal places, dates in a readable format, booleans as 'Yes'/'No')
Functional details
Strings: Display the value as is, or show '' (nothing) if the string is empty, null, or undefined.
Numbers: Apply the specified number of decimal places.
Dates: Display the date in a readable format (e.g., MM/DD/YYYY)
Booleans: Show 'Yes' for true and 'No' for false
Optional prefix and suffix:
For all data types, support optional prefix and suffix props. These can be used to add additional context around the value (e.g., currency symbol or unit symbols).
Unit Testing
Test the component with various data types (strings, numbers, dates, booleans) and verify the correct rendering of values.
Ensure the component behaves correctly when value is null, undefined, or empty.
Validate that decimalPlaces, prefix, and suffix are applied correctly.
The text was updated successfully, but these errors were encountered:
Enhance the existing
<LabelValue />
component to dynamically format and display values based on their data type. The component should accept the following props:The component should accept the following props:
value (optional): The data to be displayed.
type (required): The type of the data (string, number, date, or boolean).
label (optional): A label to display alongside the value.
path (optional): The path in the data object (from DB) where the value can be found.
decimalPlaces (optional, default: 1): The number of decimal places to use when formatting numeric values.
prefix (optional): A string to prepend to the value (e.g., a currency symbol).
suffix (optional): A string to append to the value (e.g., a percentage symbol).
The component should handle various data types such as strings, numbers, dates, and booleans, and render them appropriately (e.g., numbers with decimal places, dates in a readable format, booleans as 'Yes'/'No')
Functional details
Strings: Display the value as is, or show '' (nothing) if the string is empty, null, or undefined.
Numbers: Apply the specified number of decimal places.
Dates: Display the date in a readable format (e.g., MM/DD/YYYY)
Booleans: Show 'Yes' for true and 'No' for false
Optional prefix and suffix:
For all data types, support optional prefix and suffix props. These can be used to add additional context around the value (e.g., currency symbol or unit symbols).
Unit Testing
Test the component with various data types (strings, numbers, dates, booleans) and verify the correct rendering of values.
Ensure the component behaves correctly when value is null, undefined, or empty.
Validate that decimalPlaces, prefix, and suffix are applied correctly.
The text was updated successfully, but these errors were encountered: