Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): fix DOM nesting error for the loader spinner #2750

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions client/src/components/Loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const Loader = ({ inline, size = 120, ...rest }: LoaderProps) => {
type LoaderSpinnerProps = LoaderProps & Required<Pick<LoaderProps, "size">>;

function LoaderSpinner({ className, inline, size }: LoaderSpinnerProps) {
const Tag = inline ? "span" : "div";
const borderSize = size / 8;
const style = {
width: `${size}px`,
Expand Down Expand Up @@ -90,28 +91,38 @@ function LoaderSpinner({ className, inline, size }: LoaderSpinnerProps) {
}, []);

return (
<div
<Tag
className={cx(className, inline && "d-inline-block")}
style={containerStyle}
>
<div className="position-relative" style={style}>
<div
className={cx("position-absolute", "top-0", "start-0", "opacity-25")}
<Tag
className={cx("position-relative", inline && "d-inline-block")}
style={style}
>
<Tag
className={cx(
"position-absolute",
"top-0",
"start-0",
"opacity-25",
inline && "d-inline-block"
)}
style={trackStyle}
></div>
<div
></Tag>
<Tag
className={cx(
styles.spinner,
"position-absolute",
"top-0",
"start-0",
"opacity-100"
"opacity-100",
inline && "d-inline-block"
)}
ref={ref}
style={spinnerStyle}
></div>
</div>
</div>
></Tag>
</Tag>
</Tag>
);
}

Expand Down
Loading