Skip to content

Commit

Permalink
fix: sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
physicsSorcererKing committed Apr 28, 2024
1 parent bb5db82 commit 613b117
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 45 deletions.
7 changes: 4 additions & 3 deletions components/shared/BoxFancy/BoxFancy.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BoxFancyBorderGradientVariant,
BoxFancyBorderRadiusVariant,
BoxFancyBorderWidthVariant,
BoxFancyProps,
} from "./BoxFancy";

type ClassesFoundTest = {
Expand Down Expand Up @@ -81,7 +82,7 @@ describe("BoxFancy", () => {

const matchers = [
() => expect(baseElement.querySelector(`.${classes}`)),
() => expect(baseElement.querySelector(`.before\\\:${classes}`)),
() => expect(baseElement.querySelector(`.before\\:${classes}`)),
];
matchers.forEach((matcher) =>
found ? matcher().toBeTruthy() : matcher().toBeFalsy()
Expand All @@ -98,7 +99,7 @@ describe("BoxFancy", () => {

const matchers = [
() => expect(baseElement.querySelector(`.${classes}`)),
() => expect(baseElement.querySelector(`.before\\\:${classes}`)),
() => expect(baseElement.querySelector(`.before\\:${classes}`)),
];
matchers.forEach((matcher) =>
found ? matcher().toBeTruthy() : matcher().toBeFalsy()
Expand All @@ -114,7 +115,7 @@ describe("BoxFancy", () => {
);

const matchers = [
() => expect(baseElement.querySelector(`.before\\\:${classes}`)),
() => expect(baseElement.querySelector(`.before\\:${classes}`)),
];
matchers.forEach((matcher) =>
found ? matcher().toBeTruthy() : matcher().toBeFalsy()
Expand Down
10 changes: 4 additions & 6 deletions components/shared/BoxFancy/BoxFancy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface BaseBoxFancyProp {
borderGradientColor?: BoxFancyBorderGradientVariant;
}

export type BoxFancyProps<C extends React.ElementType> =
export type BoxFancyProps<C extends React.ElementType = "div"> =
PolymorphicComponentProp<C, BaseBoxFancyProp>;

type InnerBoxFancyComponent = <C extends React.ElementType = "div">(
Expand Down Expand Up @@ -98,11 +98,9 @@ const InnerBoxFancy: InnerBoxFancyComponent = (
]);

return (
<>
<Component ref={ref} className={allClassName} {...restProps}>
{children}
</Component>
</>
<Component ref={ref} className={allClassName} {...restProps}>
{children}
</Component>
);
};

Expand Down
70 changes: 34 additions & 36 deletions pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,45 +85,43 @@ const Login: NextPageWithProps = () => {
}, [internalEndpoint, onLoginClick]);

return checkAuth ? (
<>
<div className="relative w-full h-full flex flex-col xl:flex-row justify-between items-center p-4 gap-[18px]">
{/* fog */}
<div
className={
"absolute xl:-top-5 xl:-right-5 xl:w-[58%] xl:h-[calc(100%+40px)] rounded-2xl gradient-light shadow blur-[20px]"
}
/>
<div className="px-2 sm:px-6 xl:pl-24 2xl:px-24 flex-1 flex flex-col justify-center items-start">
{bye ? (
<p
className={
"text-primary-50 text-[22px] font-normal whitespace-pre-line mb-9"
}
>
{"原帳號已註銷成功。\n我們非常歡迎你再加入,\n和我們一起遊樂!"}
<div className="relative w-full h-full flex flex-col xl:flex-row justify-between items-center p-4 gap-[18px]">
{/* fog */}
<div
className={
"absolute xl:-top-5 xl:-right-5 xl:w-[58%] xl:h-[calc(100%+40px)] rounded-2xl gradient-light shadow blur-[20px]"
}
/>
<div className="px-2 sm:px-6 xl:pl-24 2xl:px-24 flex-1 flex flex-col justify-center items-start">
{bye ? (
<p
className={
"text-primary-50 text-[22px] font-normal whitespace-pre-line mb-9"
}
>
{"原帳號已註銷成功。\n我們非常歡迎你再加入,\n和我們一起遊樂!"}
</p>
) : null}
<h2 className="relative flex items-center text-[22px] font-normal text-primary-100 mb-12">
<Icon name="leadingIcon" className="w-12 h-12" />
遊戲微服務大平台
</h2>
{!bye ? (
<>
<p className="text-primary-50 text-[32px] font-medium mb-4">
一起創造與冒險!
</p>
) : null}
<h2 className="relative flex items-center text-[22px] font-normal text-primary-100 mb-12">
<Icon name="leadingIcon" className="w-12 h-12" />
遊戲微服務大平台
</h2>
{!bye ? (
<>
<p className="text-primary-50 text-[32px] font-medium mb-4">
一起創造與冒險!
</p>
<p className="text-primary-50 text-[22px] font-normal">
加入遊戲微服務大平台,和100+遊戲開發者共同創建更多可能!
</p>
</>
) : null}
</div>
<p className="text-primary-50 text-[22px] font-normal">
加入遊戲微服務大平台,和100+遊戲開發者共同創建更多可能!
</p>
</>
) : null}
</div>

<div className="flex-1 flex flex-col justify-center items-center w-full px-[124px] gap-5">
{loginButtons}
</div>
<div className="flex-1 flex flex-col justify-center items-center w-full px-[124px] gap-5">
{loginButtons}
</div>
</>
</div>
) : (
<></>
);
Expand Down

0 comments on commit 613b117

Please sign in to comment.