Skip to content

Commit

Permalink
Merge pull request #478 from Kannav02/issue-457
Browse files Browse the repository at this point in the history
Added support for Formik and Yup in Hint FE
  • Loading branch information
swoopertr authored Jan 14, 2025
2 parents 9b3a67e + 82e5700 commit d084acf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
import React, { useMemo } from "react";
import ColorTextField from "../../ColorTextField/ColorTextField";
import "./HintLeftAppearance.css";
import { Formik, useFormikContext, Form } from "formik";
import * as Yup from "yup";

const colorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
const validationSchema = Yup.object({
headerBackgroundColor: Yup.string()
.required("Header background color is required")
.matches(colorRegex,"Header background must be a valid hex color"),

headerColor: Yup.string()
.required("Header color is required")
.matches(colorRegex,"Header color must be a valid hex color"),

textColor: Yup.string()
.required("Text color is required")
.matches(colorRegex,"Text color must be a valid hex color"),

buttonBackgroundColor: Yup.string()
.required("Button background color is required")
.matches(colorRegex,"Button background must be a valid hex color"),

buttonTextColor: Yup.string()
.required("Button text color is required")
.matches(colorRegex,"Button text color must be a valid hex color"),
});

const HintLeftAppearance = ({ data = [] }) => {
const content = useMemo(() => {
if (data.length === 0) {
return <div className="hint-appearance-container">No data available</div>;
}

return (
<div className="hint-appearance-container">
{data.map(({ stateName, state, setState }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import React from "react";
import DropdownList from "../../DropdownList/DropdownList";
import CustomTextField from "../../TextFieldComponents/CustomTextField/CustomTextField";
import "./HintLeftContent.css";
import { Formik, useFormikContext, Form } from "formik";
import * as Yup from "yup";

const validationSchema = Yup.object().shape({

});

const HintLeftContent = ({ actionButtonText, setActionButtonText, actionButtonUrl, setActionButtonUrl, action, setAction, targetElement, setTargetElement, tooltipPlacement, setTooltipPlacement }) => {
const handleActionButtonText = (event) => {
Expand Down

0 comments on commit d084acf

Please sign in to comment.