tsx to jsx and components to Components

This commit is contained in:
MuhammadKhalilzadeh committed 2024-05-15 09:40:50 +03:30
1 parent fb9318fd74
commit 7888205375
24 files changed
+1248

No files matched your search

@@ -0,0 +1,47 @@
import React from "react";
import "./descriptionTextField.css";
import { TextField } from "@mui/material";
import PropTypes from "prop-types";
import { useTheme } from "@mui/material";
/**
* @component
* @param {Object} props
* @param {string} props.hintText - The hint text displayed within the text field (required)
* @param {boolean} props.hasError - A flag indicating if the text field has an error (required)
* @returns {JSX.Element} - Renders the description text field component
*/
const DescriptionTextField = ({ hintText, hasError }) => {
const theme = useTheme();
const fontLookup = {
default: theme.font.default.font,
};
const fontFamily = fontLookup["default"];
return (
<div
className="description-field-holder"
style={{ fontFamily: fontFamily }}
>
<div className="text-field-title">Description</div>
<TextField
id="description-field-area"
error={hasError}
className="description-field-area"
multiline
rows={4}
placeholder="Enter a description..."
helperText={hintText}
/>
</div>
);
};
DescriptionTextField.propTypes = {
hintText: PropTypes.string.isRequired,
hasError: PropTypes.bool.isRequired,
};
export default DescriptionTextField;
@@ -0,0 +1,45 @@
:root {
--color-title-1: #344054;
--text-field-margin-0: 10px 20px;
--description-color-0: #344054;
}
.description-field-holder {
margin: var(--text-field-margin-0);
margin-top: 20px;
}
.text-field-title {
color: var(--color-title-1);
font-weight: bold;
margin-bottom: 10px;
font-size: 13px;
color: var(--description-color-0);
font-weight: bold;
}
.description-field-area {
min-width: 320px;
font-size: 13px;
border-radius: 8px;
}
.description-field-label {
margin-top: 10px;
font-size: 11px;
}
.with-error {
color: red;
}
#description-field-area-helper-text {
margin-left: 0;
margin-top: 10px;
font-size: 11px;
}
#description-field-area {
min-width: 320px;
font-size: 13px;
}