forked from upyog/UPYOG
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from egovernments/ISNE-223
Corrected FormComposerV2 Error
- Loading branch information
Showing
13 changed files
with
2,276 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
frontend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/Button.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
/** | ||
* Button Component | ||
* | ||
* @author jagankumar-egov | ||
* | ||
* Feature :: CORE | ||
* | ||
* @example | ||
* // Primary button | ||
<Button label={t(configs?.label)} onButtonClick={()=>{}} type="button" style={{ marginLeft: "10px" }} /> | ||
// Secondary button & Optional with Icon | ||
<Button label={t(configs?.label)} variation="secondary" icon={<AddFilled />} onButtonClick={()=>{}} type="button" style={{ marginLeft: "10px" }} /> | ||
// Disabled Button | ||
<Button label={t("Disabled")} onButtonClick={()=>{}} type="button" style={{ marginLeft: "10px" }} isDisabled={true} /> | ||
*/ | ||
|
||
const Button = (props) => { | ||
let className = props?.variation !== "primary" ? `jk-digit-secondary-btn` : `jk-digit-primary-btn`; | ||
return ( | ||
<button | ||
className={`${className} ${(props?.className && props?.className) || ""} ${(props?.isDisabled && "jk-digit-disabled-btn") || ""}`} | ||
type={props.type || "button"} | ||
form={props.formId} | ||
onClick={props.onButtonClick} | ||
disabled={props?.isDisabled} | ||
style={props.style ? props.style : null} | ||
onChange={props?.onChange} | ||
> | ||
{props?.icon && props.icon} | ||
<h2 style={{ ...props?.textStyles, ...{ width: "100%" } }}>{props.label}</h2> | ||
{props.children} | ||
</button> | ||
); | ||
}; | ||
|
||
Button.propTypes = { | ||
/** | ||
* ButtonSelector content | ||
*/ | ||
label: PropTypes.string.isRequired, | ||
/** | ||
* button border theme | ||
*/ | ||
variation: PropTypes.string, | ||
/** | ||
* button icon if any | ||
*/ | ||
icon: PropTypes.element, | ||
/** | ||
* click handler | ||
*/ | ||
onButtonClick: PropTypes.func.isRequired, | ||
/** | ||
* Custom classname | ||
*/ | ||
className: PropTypes.string, | ||
/** | ||
* Custom styles | ||
*/ | ||
style: PropTypes.object, | ||
/** | ||
* Custom label style or h2 style | ||
*/ | ||
textStyles: PropTypes.object, | ||
}; | ||
|
||
Button.defaultProps = { | ||
label: "TEST", | ||
variation: "primary", | ||
onButtonClick: () => {}, | ||
}; | ||
|
||
export default Button; |
52 changes: 52 additions & 0 deletions
52
...tend/micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/HorizontalNav.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
|
||
const HorizontalNav = ({ | ||
configNavItems, | ||
activeLink, | ||
setActiveLink, | ||
showNav = false, | ||
children, | ||
customStyle = {}, | ||
customClassName = "", | ||
inFormComposer = true, | ||
navClassName = "", | ||
navStyles = {}, | ||
}) => { | ||
const { t } = useTranslation(); | ||
|
||
const setActive = (item) => { | ||
setActiveLink(item.name); | ||
}; | ||
|
||
const MenuItem = ({ item }) => { | ||
let itemComponent = item.code; | ||
|
||
const Item = () => ( | ||
<span className="menu-item"> | ||
<div className="menu-label">{t(itemComponent)}</div> | ||
</span> | ||
); | ||
|
||
return <Item />; | ||
}; | ||
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 === item.name ? "active" : ""}`} key={index} onClick={() => setActive(item)}> | ||
<MenuItem item={item} /> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default HorizontalNav; |
Oops, something went wrong.