Skip to content

Commit

Permalink
Merge pull request #46 from Atnic/feature/alert
Browse files Browse the repository at this point in the history
fix: undefined document on injectStyles
  • Loading branch information
muhamien authored Mar 21, 2024
2 parents 7b57aa9 + f865d10 commit ccb9f2a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/components/alert/src/alert.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"use client";

import {forwardRef} from "@jala-banyu/system";
import {CloseIcon} from "@jala-banyu/shared-icons";
import {injectStyle} from "react-toastify/dist/inject-style";
import React from "react";

import {UseAlertProps, useAlert} from "./use-alert";

Expand Down Expand Up @@ -29,7 +32,11 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => {
ref,
});

injectStyle();
React.useEffect(() => {
if (typeof document !== "undefined") {
injectStyle();
}
}, []);

const renderEndContent = endContent ? (
<div {...getEndContentProps()}>{endContent}</div>
Expand Down

0 comments on commit ccb9f2a

Please sign in to comment.