Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving inboxsearchcomposerv2 #51

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,174 changes: 654 additions & 520 deletions react/css/example/index.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions react/example/.eslintcache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-project": "0.3.4",
"@egovernments/digit-ui-module-sample": "0.0.1",
"@egovernments/digit-ui-react-components": "1.7.10",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"@egovernments/digit-ui-svg-components": "1.0.4",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion react/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css/dist/index.css"/> -->
<!-- <script src="https://s3.ap-south-1.amazonaws.com/egov-dev-assets/globalConfigs.js"></script> -->
<!-- <script src="%REACT_APP_GLOBAL%"></script> -->
<script src="%REACT_APP_GLOBAL%"></script>

</head>

Expand Down
2 changes: 1 addition & 1 deletion react/modules/Project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"@egovernments/digit-ui-components": "0.0.1-beta.11",
"lodash": "^4.17.21",
"react": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion react/modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.1-beta.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
2 changes: 1 addition & 1 deletion react/modules/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"@egovernments/digit-ui-components": "0.0.1-beta.11",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-project": "0.3.4",
"@egovernments/digit-ui-module-sample": "0.0.1",
"@egovernments/digit-ui-react-components": "1.7.10",
"@egovernments/digit-ui-react-components": "1.8.1-beta.11",
"@egovernments/digit-ui-svg-components": "1.0.4",
"@egovernments/digit-ui-components": "0.0.1-beta.11",
"babel-loader": "8.1.0",
Expand Down
11 changes: 11 additions & 0 deletions react/ui-components/src/atoms/CardLabelDesc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

const CardLabelDesc = ({ children, style, className }) => {
return (
<h2 className={`card-label-desc ${className ? className : ""}`} style={style}>
{children}
</h2>
);
};

export default CardLabelDesc;
11 changes: 11 additions & 0 deletions react/ui-components/src/atoms/CardSectionHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";

const CardSectionHeader = (props) => {
return (
<header id={props.id} className="card-section-header" style={props.style}>
{props.children}
</header>
);
};

export default CardSectionHeader;
16 changes: 16 additions & 0 deletions react/ui-components/src/atoms/CardSubHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";

const CardSubHeader = (props) => {
const user_type = Digit.SessionStorage.get("user_type") === "employee" ? true : false;

return (
<header
className={`${user_type ? "employee-card-sub-header" : "card-sub-header"} ${props?.className ? props?.className : ""}`}
style={props.style}
>
{props.children}
</header>
);
};

export default CardSubHeader;
155 changes: 64 additions & 91 deletions react/ui-components/src/atoms/CheckBox.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,71 @@
import React, { Fragment } from "react";
import { SVG } from "./SVG";
import StringManipulator from "./StringManipulator";
import React,{Fragment} from "react";
import { CheckSvg } from "./svgindex";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";

const CheckBox = ({
onChange,
label,
value,
disabled,
ref,
checked,
inputRef,
pageType,
style,
index,
isLabelFirst,
customLabelMarkup,
...props
}) => {
const { t } = useTranslation();
const userType = pageType || window?.Digit?.SessionStorage.get("userType");
let styles = props.styles;

const sentenceCaseLabel = StringManipulator("toSentenceCase", label);

return (
<div
className={`digit-checkbox-container ${
!isLabelFirst ? "checkboxFirst" : "labelFirst"
} ${disabled ? "disabled" : " "}`}
>
{isLabelFirst ? (
<p className="label" style={{ maxWidth: "100%", width: "auto" ,marginRight:"0rem"}}>
{customLabelMarkup ? (
<>
<span>{t("COMMON_CERTIFY_ONE")}</span>
<br />
<span>
<b> {t("ES_COMMON_NOTE")}</b>
{t("COMMON_CERTIFY_TWO")}
</span>
</>
) : (
sentenceCaseLabel
)}
</p>
) : null}
<div style={{ cursor: "pointer", display: "flex", position: "relative" }}>
<input
type="checkbox"
className={`input ${userType === "employee" ? "input-emp" : ""}`}
onChange={onChange}
value={value || label}
{...props}
ref={inputRef}
disabled={disabled}
checked={checked}
/>
<p
className={`digit-custom-checkbox ${
userType === "employee" ? "digit-custom-checkbox-emp" : ""
}`}
>
<SVG.Check fill={disabled ? "#B1B4B6" : "#F47738"} />
const CheckBox = ({ onChange, label, value, disable, ref, checked, inputRef, pageType, style, index, isLabelFirst,customLabelMarkup, ...props }) => {
const { t } = useTranslation()
const userType = pageType || Digit.SessionStorage.get("userType");
let wrkflwStyle = props.styles;
if (isLabelFirst) {
return (
<div className="checkbox-wrap" style={wrkflwStyle ? wrkflwStyle : {}}>
<p style={style ? style : null}> {index+1}.</p>
<p className="label" style={{maxWidth: "80%", marginLeft: "10px"}}>
{label}
</p>
<div>
<input
type="checkbox"
className={userType === "employee" ? "input-emp" : ""}
onChange={onChange}
style={{ cursor: "pointer", left: "90%" }}
value={value || label}
{...props}
ref={inputRef}
disabled={disable}
checked={checked}
/>
<p className={userType === "employee" ? "custom-checkbox-emp" : "custom-checkbox"} style={disable ? { opacity: 0.5 } : {left: "90%"}}>
<CheckSvg />
</p>
</div>
</div>
{!isLabelFirst ? (
<p className="label" style={{ maxWidth: "100%", width: "100%",marginRight:"0rem" }}>
{customLabelMarkup ? (
<>
<span>{t("COMMON_CERTIFY_ONE")}</span>
<br />
<span>
<b> {t("ES_COMMON_NOTE")}</b>
{t("COMMON_CERTIFY_TWO")}
</span>
</>
) : (
sentenceCaseLabel
)}
);
} else {
return (
<div className="checkbox-wrap" style={wrkflwStyle ? wrkflwStyle : {}}>
<div>
<input
type="checkbox"
className={userType === "employee" ? "input-emp" : ""}
onChange={onChange}
style={{ cursor: "pointer" }}
value={value || label}
{...props}
ref={inputRef}
disabled={disable}
// {(checked ? (checked = { checked }) : null)}
checked={checked}
/>
<p className={userType === "employee" ? "custom-checkbox-emp" : "custom-checkbox"} style={disable ? { opacity: 0.5 } : (props?.checkboxWidth ? {...props?.checkboxWidth} : null)}>
{/* <img src={check} alt="" /> */}
<CheckSvg />
</p>
</div>
<p className="label" style={style ? style : null}>
{customLabelMarkup ?
<>
<p>{t("COMMON_CERTIFY_ONE")}</p>
<br />
<p>
<b> {t("ES_COMMON_NOTE")}</b>{t("COMMON_CERTIFY_TWO")}
</p>
</> : label}
</p>
) : null}
</div>
);
</div>
);
}
Comment on lines +5 to +67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modifications to support different label and checkbox placements based on the isLabelFirst prop are well-implemented. Consider optimizing the prop handling to minimize unnecessary re-renders and improve performance.


};

CheckBox.propTypes = {
Expand All @@ -102,15 +84,6 @@ CheckBox.propTypes = {
userType: PropTypes.string,
};

CheckBox.defaultProps = {
label: "Default",
isLabelFirst: false,
onChange: () => console.log("CLICK"),
value: "",
checked: false,
ref: "ww",
// pageType: "EMPLOYEE",
index: 0,
};
CheckBox.defaultProps = {};

export default CheckBox;
56 changes: 56 additions & 0 deletions react/ui-components/src/atoms/HorizontalNavV2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, {useState} from 'react'
import { useTranslation } from 'react-i18next'
import BreakLine from './BreakLine'
const HorizontalNavV2 = ({ configNavItems, activeLink, setActiveLink, showNav = false, children, customStyle = {}, customClassName = "", inFormComposer = true, navClassName = "", navStyles = {},fromSearchComp=false,horizontalLine=false }) => {
const { t } = useTranslation()
const setActive = (item) => {
setActiveLink(item)
}

const MenuItem = ({ item }) => {
let itemComponent = item.code;

const Item = () => (
<span className="menu-item">
<div className="menu-label">{t(itemComponent)}</div>
</span>
);

return (
<Item />
);
};

if(fromSearchComp) {
return (
<div className={navClassName} style={fromSearchComp ?{width:"100%",...navStyles} :{...navStyles}}>
{showNav && <div className={fromSearchComp?`horizontal-nav ${customClassName}`:`horizontal-nav ${customClassName}`} style={inFormComposer?{ marginLeft: "16px", marginRight: "16px", marginTop:"0px",...customStyle }:{...customStyle}} >
{configNavItems?.map((item, index) => (
<div className={`sidebar-list-search-form ${activeLink?.name === item.name ? "active" : ""}`} key={index} onClick={() => setActive(item)}>
<MenuItem item={item} />
</div>
))}
</div>
}
{/* Commenting out for now due to horizontal line coming in every inbox as well */}
{horizontalLine && <BreakLine style={{margin:"0px 16px 0px 16px"}}/>}
{children}
</div>
)
}
return (
<div className={navClassName} style={{...navStyles}}>
{showNav && <div className={`horizontal-nav ${customClassName}`} style={inFormComposer?{ marginLeft: "16px", marginRight: "16px", ...customStyle }:{...customStyle}} >
{configNavItems?.map((item, index) => (
<div className={`sidebar-list ${activeLink?.name === item.name ? "active" : ""}`} key={index} onClick={() => setActive(item)}>
<MenuItem item={item} />
</div>
))}
</div>
}
{children}
</div>
)
}

export default HorizontalNavV2
3 changes: 1 addition & 2 deletions react/ui-components/src/atoms/InboxSearchLinks.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useState, useEffect } from "react"
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
// import { PropertyHouse, BioMetricIcon,WorksMgmtIcon} from "./svgindex";

const getIconComponent = (iconName="")=>{
return require("@egovernments/digit-ui-svg-components")?.[iconName];
return require("@egovernments/digit-ui-react-components")?.[iconName];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep as svg

}

const InboxSearchLinks = ({headerText, links, businessService, customClass="", logoIcon}) => {
Expand Down
25 changes: 25 additions & 0 deletions react/ui-components/src/atoms/LinkButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import PropTypes from "prop-types";

const LinkButton = (props) => {
return (
<span className={`card-link cp ${props.className}`} onClick={props.onClick} style={props.style}>
{props.label}
</span>
);
};

LinkButton.propTypes = {
/**
* LinkButton contents
*/
label: PropTypes.any,
/**
* Optional click handler
*/
onClick: PropTypes.func,
};

LinkButton.defaultProps = {};

export default LinkButton;
Loading