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,73 @@
import "./dualButtonPopupModalWithTextfields.css";
import React from "react";
import CloseIcon from "@mui/icons-material/Close";
import PropTypes from "prop-types";
import { useTheme } from "@mui/material";
/**
* @component
* @param {Object} props
* @param {string} props.title - The title text for the modal (required)
* @returns {JSX.Element} - Renders a single text field component within a popup modal
*/
const PopupModalTextfield = ({ title }) => {
const theme = useTheme();
const fontLookup = {
default: theme.font.default.font,
};
const fontFamily = fontLookup["default"];
return (
<div className="popup-modal-input" style={{ fontFamily: fontFamily }}>
<div className="popup-modal-input-title">{title}</div>
<input type="text" className="popup-modal-text-field" />
</div>
);
};
/**
* @component
* @param {Object} props
* @param {string} props.title - The title text for the modal (required)
* @param {string} props.esc - The text for the cancel button (required)
* @param {string} props.save - The text for the save button (required)
* @returns {JSX.Element} - Renders the dual button popup modal component with text fields
*/
const DualButtonPopupModalWithTextfields = ({ title, esc, save }) => {
const theme = useTheme();
const fontLookup = {
default: theme.font.default.font,
};
const fontFamily = fontLookup["default"];
return (
<div className="popup-modal-holder" style={{ fontFamily: fontFamily }}>
<div className="popup-modal-header">
<div className="popup-modal-title">{title}</div>
<div className="popup-modal-close">
<CloseIcon style={{ fill: "#98A2B3" }} />
</div>
</div>
<div className="spacing-height"></div>
<PopupModalTextfield title="Name" />
<div className="spacing-height"></div>
<div className="spacing-height"></div>
<div className="popup-modal-controllers">
<button className="white-cancel-button">{esc}</button>
<button className="blue-save-button">{save}</button>
</div>
</div>
);
};
DualButtonPopupModalWithTextfields.propTypes = {
title: PropTypes.string.isRequired,
esc: PropTypes.string.isRequired,
save: PropTypes.string.isRequired,
};
export default DualButtonPopupModalWithTextfields;
@@ -0,0 +1,61 @@
:root {
--popup-color-with-input-border-0: #f2f2f2;
--popup-color-with-input-border-1: #d0d5dd;
--popup-modal-with-input-title-color: #344054;
}
.popup-modal-holder {
width: 480px;
font-family: var(--popup-font-family-0);
padding: 50px 40px;
border-radius: 4px;
margin: 10px 20px;
border: 1px solid var(--popup-color-with-input-border-0);
box-shadow: 0px 8px 8px -4px rgba(16, 24, 40, 0.03),
0px 20px 24px -4px rgba(16, 24, 40, 0.08);
}
.popup-modal-header {
display: flex;
justify-content: space-between;
font-weight: bold;
}
.popup-modal-close {
cursor: pointer;
}
.spacing-height {
height: 30px;
}
.popup-modal-input-title {
margin-bottom: 15px;
color: var(--popup-modal-with-input-title-color);
}
.popup-modal-text-field {
width: 100%;
height: 35px;
border: 1px solid var(--popup-color-with-input-border-1);
border-radius: 4px;
}
.popup-modal-controllers {
display: flex;
justify-content: end;
}
.white-cancel-button {
border: none;
background-color: transparent;
font-family: var(--popup-font-family-0);
margin: 5px 10px;
width: 145px;
height: 35px;
padding: 5px 20px;
border: 1px solid var(--popup-color-with-input-border-1);
border-radius: 4px;
cursor: pointer;
font-size: 13px;
}