Skip to content

Commit

Permalink
chore(sonar): address issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekys committed Jan 26, 2024
1 parent 7d3be6e commit 7334a70
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { Modal, Icon, Message } from "semantic-ui-react";
import PropTypes from "prop-types";

export function ConfirmationModal({
header,
Expand Down Expand Up @@ -35,4 +36,13 @@ export function ConfirmationModal({
);
}

ConfirmationModal.propTypes = {
header: PropTypes.string,
content: PropTypes.string,
trigger: PropTypes.element,
actions: PropTypes.node,
isOpen: PropTypes.bool,
close: PropTypes.func,
};

export default ConfirmationModal;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Button, Icon } from "semantic-ui-react";
import { Button } from "semantic-ui-react";
import { i18next } from "@translations/i18next";
import {
useConfirmationModal,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from "react";
import { useFormikContext } from "formik";
import { Message } from "semantic-ui-react";
import PropTypes from "prop-types";

// component to visualize formik state on screen during development
export const FormikStateLogger = ({ target = "" }) => {
export const FormikStateLogger = ({ render = false }) => {
const state = useFormikContext();
if (process.env.NODE_ENV !== "development") {
return;
}

if (target === "dom") {
if (render) {
return (
<Message>
<Message.Header>Current record state</Message.Header>
Expand All @@ -21,3 +22,9 @@ export const FormikStateLogger = ({ target = "" }) => {
console.debug("[form state]: ", state, "\n[form values]:", state.values);
return <></>;
};

FormikStateLogger.propTypes = {
render: PropTypes.bool,
};

export default FormikStateLogger;

0 comments on commit 7334a70

Please sign in to comment.