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 #46

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
553 changes: 339 additions & 214 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.

4 changes: 2 additions & 2 deletions react/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"build": "webpack --mode production"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.1-beta.5",
"@egovernments/digit-ui-components": "0.0.1-beta.1",
"@egovernments/digit-ui-libraries": "1.8.2-beta.1",
"@egovernments/digit-ui-module-common": "1.7.10",
"@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.10",
"@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
4 changes: 2 additions & 2 deletions react/modules/Project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.10",
"@egovernments/digit-ui-components": "0.0.1-beta.1",
"lodash": "^4.17.21",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
import {InboxSearchComposer, Loader, Button ,AddFilled} from "@egovernments/digit-ui-components";
import {Loader, Button ,AddFilled} from "@egovernments/digit-ui-components";

Choose a reason for hiding this comment

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

Check import

import InboxSearchComposerV2 from "../../../../../../ui-components/src/hoc/InboxSearchComposerV2";
import { Header } from "@egovernments/digit-ui-react-components";
import { useHistory, useLocation } from "react-router-dom";
import searchConfigMUKTA from "../../../configs/searchConfigMUKTA";
Expand Down Expand Up @@ -68,7 +69,7 @@ const ProjectSearch = () => {
)}
</div>
<div className="inbox-search-wrapper">
<InboxSearchComposer configs={configs}></InboxSearchComposer>
<InboxSearchComposerV2 configs={configs}></InboxSearchComposerV2>

Choose a reason for hiding this comment

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

Browsersession is required in v2

</div>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Header, Loader,InboxSearchComposer} from "@egovernments/digit-ui-components";
import { Header, Loader} from "@egovernments/digit-ui-components";
import InboxSearchComposerV2 from "../../../../../../ui-components/src/hoc/InboxSearchComposerV2";

Choose a reason for hiding this comment

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

Import here

import inboxConfig from "../../../configs/InboxConfig";

const ProjectSearchAndInboxComponent = () => {
Expand All @@ -25,7 +26,7 @@ const ProjectSearchAndInboxComponent = () => {
<React.Fragment>
<Header styles={{ fontSize: "32px" }}>{t(configs?.label)}</Header>
<div className="inbox-search-wrapper">
<InboxSearchComposer configs={configs}></InboxSearchComposer>
<InboxSearchComposerV2 configs={configs}></InboxSearchComposerV2>

Choose a reason for hiding this comment

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

Browser session?

</div>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Button, Loader ,InboxSearchComposer } from "@egovernments/digit-ui-components";
import { Button, Loader } from "@egovernments/digit-ui-components";
import InboxSearchComposerV2 from "../../../../../../ui-components/src/hoc/InboxSearchComposerV2";
import { Header } from "@egovernments/digit-ui-react-components";
import { useHistory, useLocation } from "react-router-dom";
import searchWMSProjectConfig from "../../../configs/searchWMSProjectConfig";
Expand Down Expand Up @@ -71,7 +72,7 @@ const ProjectWMSSearch = () => {
)}
</div>
<div className="inbox-search-wrapper">
<InboxSearchComposer configs={configs}></InboxSearchComposer>
<InboxSearchComposerV2 configs={configs}></InboxSearchComposerV2>
</div>
</React.Fragment>
);
Expand Down
4 changes: 2 additions & 2 deletions react/modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.1-beta.1",
"@egovernments/digit-ui-react-components": "1.8.1-beta.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
4 changes: 2 additions & 2 deletions react/modules/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.4",
"@egovernments/digit-ui-components": "0.0.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.10",
"@egovernments/digit-ui-components": "0.0.1-beta.1",
"react": "17.0.2",
"react-date-range": "^1.4.0",
"react-dom": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
"@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.10",
"@egovernments/digit-ui-svg-components": "1.0.4",
"@egovernments/digit-ui-components": "0.0.1-beta.5",
"@egovernments/digit-ui-components": "0.0.1-beta.1",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "4.0.0",
"css-loader": "5.2.6",
Expand Down
2 changes: 1 addition & 1 deletion react/ui-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-components",
"version": "0.0.1-beta.5",
"version": "0.0.1-beta.1",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
150 changes: 56 additions & 94 deletions react/ui-components/src/atoms/CheckBox.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,64 @@
import React, { Fragment } from "react";
import { SVG } from "./SVG";
import StringManipulator from "./StringManipulator";
import React 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-wrap ${
!isLabelFirst ? "checkboxFirst" : "labelFirst"
} ${disabled ? "disabled" : " "}`}
>
{isLabelFirst ? (
<p className="label" style={{ maxWidth: "100%", width: "auto" }}>
{customLabelMarkup ? (
<>
<span>{t("COMMON_CERTIFY_ONE")}</span>
<br />
<span>
<b> {t("ES_COMMON_NOTE")}</b>
{t("COMMON_CERTIFY_TWO")}
</span>
</>
) : (
sentenceCaseLabel
)}
const CheckBox = ({ onChange, label, value, disable, ref, checked, inputRef, pageType, style, index, isLabelFirst, ...props }) => {
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>
) : null}
<div style={{ cursor: "pointer", display: "flex", position: "relative" }}>
<div>
<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"} />
</p>
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%" }}>
{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}>
{label}
</p>
) : null}
</div>
);
</div>
);
}

};

CheckBox.propTypes = {
/**
* CheckBox content
Expand All @@ -101,16 +74,5 @@ CheckBox.propTypes = {
ref: PropTypes.func,
userType: PropTypes.string,
};

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

export default CheckBox;
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
8 changes: 2 additions & 6 deletions react/ui-components/src/atoms/InboxSearchLinks.js
Original file line number Diff line number Diff line change
@@ -1,12 +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];
}

const InboxSearchLinks = ({headerText, links, businessService, customClass="", logoIcon}) => {

const { t } = useTranslation();
Expand Down Expand Up @@ -39,5 +36,4 @@ const InboxSearchLinks = ({headerText, links, businessService, customClass="", l
)

}

export default InboxSearchLinks;
export default InboxSearchLinks;
Loading