Skip to content

Commit

Permalink
change treeView appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
anistouri committed Nov 8, 2023
1 parent b82955b commit b3e0902
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/components/TreeViewFinder/TreeViewFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const composeClasses = makeComposeClasses(generateTreeViewFinderClass);
* @param {String} [validationButtonText=default text] - Customized Validation Button text (default: Add N Elements)
* @param {Boolean} [onlyLeaves=true] - Allow/Forbid selection only on leaves
* @param {Boolean} [multiselect=false] - Allow/Forbid multiselection on Tree
* @param {Boolean} [withCustomColor=true] - Display a custom color on the cancel button
*/
const TreeViewFinder = (props) => {
const intl = useIntl();
Expand All @@ -114,6 +115,7 @@ const TreeViewFinder = (props) => {
multiselect,
sortMethod,
className,
withCustomColor = true,
} = props;

const [mapPrintedNodes, setMapPrintedNodes] = useState({});
Expand Down Expand Up @@ -344,17 +346,17 @@ const TreeViewFinder = (props) => {
</DialogContent>
<DialogActions>
<Button
variant="contained"
style={{ float: 'left', margin: '5px' }}
onClick={() => {
onClose([]);
setSelected([]);
}}
color={withCustomColor ? 'customButton' : 'primary'}
>
<FormattedMessage id="treeview_finder/cancel" />
</Button>
<Button
variant="contained"
variant="outlined"
style={{ float: 'left', margin: '5px' }}
onClick={() => {
onClose(computeSelectedNodes());
Expand Down Expand Up @@ -392,6 +394,7 @@ TreeViewFinder.propTypes = {
onlyLeaves: PropTypes.bool,
multiselect: PropTypes.bool,
sortMethod: PropTypes.func,
withCustomColor: PropTypes.bool,
};

/* TreeViewFinder props default values */
Expand Down
8 changes: 6 additions & 2 deletions src/components/react-hook-form/utils/submit-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ import { Button } from '@mui/material';
import { useFormState } from 'react-hook-form';
import { FormattedMessage } from 'react-intl';

const SubmitButton = ({ onClick, disabled = false }) => {
const SubmitButton = ({ onClick, disabled = false, variant }) => {
const { isDirty } = useFormState();

return (
<Button onClick={onClick} disabled={!isDirty || disabled}>
<Button
onClick={onClick}
disabled={!isDirty || disabled}
variant={variant}
>
<FormattedMessage id="validate" />
</Button>
);
Expand Down

0 comments on commit b3e0902

Please sign in to comment.