Skip to content

Commit

Permalink
UI UPDATE & FIX : update the toast styling & fix the global input com…
Browse files Browse the repository at this point in the history
…ponoents
  • Loading branch information
shyamtala-dev authored Apr 26, 2024
1 parent 527642d commit 8052c51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/formComponents/RadioGroupInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const RadioGroupInput = ({ name, register, errors, valueArray = [] }) => {
</div>
<div
className={`mt-2 collapse ${
errors.username ? "collapse-open" : "collapse-close"
errors[name]?.message ? "collapse-open" : "collapse-close"
}`}
>
<p className="text-red-300 collapse-content p-0 pl-3 pb-2">
Expand Down
2 changes: 2 additions & 0 deletions src/components/formComponents/TextInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const TextInput = ({
name,
label,
placeholder,
defaultValue = undefined,
register,
errors,
style = "",
Expand All @@ -25,6 +26,7 @@ const TextInput = ({
type="text"
className={`grow` + style}
placeholder={placeholder}
defaultValue={defaultValue}
{...register(name)}
/>
</label>
Expand Down
13 changes: 12 additions & 1 deletion src/components/global/Toast.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import { Slide, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

export default function Toast() {
const contextClass = {
success: "bg-green-600",
error: "bg-red-600",
info: "bg-gray-600",
warning: "bg-orange-400",
default: "bg-green-600",
dark: "bg-white-600 font-gray-300",
};

return (
<ToastContainer
position="top-center"
Expand All @@ -17,7 +26,9 @@ export default function Toast() {
theme="colored"
transition={Slide}
toastClassName={(context) => {
return `relative bg-red-600 bg-opacity-50 flex p-1 min-h-10 w-full rounded-md justify-between backdrop-blur-lg overflow-hidden cursor-pointer`;
return `${
contextClass[context?.type || "default"]
} relative bg-opacity-50 flex p-1 w-full rounded-md justify-between backdrop-blur-lg overflow-hidden cursor-pointer`;
}}
/>
);
Expand Down

0 comments on commit 8052c51

Please sign in to comment.