Skip to content

Commit

Permalink
refactor: 서윤님 피드백 반영
Browse files Browse the repository at this point in the history
- pandaCSS로 스타일 이전
  - cva사용
- red.500 -> red 로 변경 (토큰값)
- isLoading 표시 올바르게 변경
- dummy error boolean값 삭제
  • Loading branch information
hyonun321 committed Nov 18, 2024
1 parent 748e573 commit 2c2ecac
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client/src/components/modal/ErrorModal.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export const errorModalWrapper = css({
});

export const errorMessageItem = css({
color: "red.500",
color: "red",
fontSize: "sm",
});
31 changes: 26 additions & 5 deletions client/src/features/workSpace/WorkSpace.style.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
import { css } from "@styled-system/css";

export const container = css({
display: "flex",
});
import { css, cva } from "@styled-system/css";

export const content = css({
position: "relative",
padding: "md",
});

export const workSpaceContainer = cva({
base: {
display: "flex",
transition: "opacity 0.3s ease-in-out",
},
variants: {
visibility: {
visible: {
visibility: "visible",
},
hidden: {
visibility: "hidden",
},
},
opacity: {
1: {
opacity: 1,
},
0: {
opacity: 0,
},
},
},
});
14 changes: 6 additions & 8 deletions client/src/features/workSpace/WorkSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@ import { BottomNavigator } from "@components/bottomNavigator/BottomNavigator";
import { ErrorModal } from "@components/modal/ErrorModal";
import { Sidebar } from "@components/sidebar/Sidebar";
import { Page } from "@features/page/Page";
import { container, content } from "./WorkSpace.style";
import { workSpaceContainer, content } from "./WorkSpace.style";
import { IntroScreen } from "./components/IntroScreen";
import { usePagesManage } from "./hooks/usePagesManage";
import { useWorkspaceInit } from "./hooks/useWorkspaceInit";

export const WorkSpace = () => {
const { isLoading, isInitialized } = useWorkspaceInit();
const { isLoading, isInitialized, error } = useWorkspaceInit();

const { pages, addPage, selectPage, closePage, updatePageTitle } = usePagesManage();
const visiblePages = pages.filter((page) => page.isVisible);
const error = true;

if (error) {
return <ErrorModal errorMessage="test" />;
}

return (
<>
{isLoading} && <IntroScreen />
{isLoading && <IntroScreen />}
<div
className={container}
style={{
className={workSpaceContainer({
visibility: isInitialized && !isLoading ? "visible" : "hidden",
opacity: isInitialized && !isLoading ? 1 : 0,
transition: "opacity 0.3s ease-in-out",
}}
})}
>
<Sidebar pages={pages} handlePageAdd={addPage} handlePageSelect={selectPage} />
<div className={content}>
Expand Down
13 changes: 13 additions & 0 deletions client/src/features/workSpace/components/IntroScreen.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { css, cva } from "@styled-system/css";

Check warning on line 1 in client/src/features/workSpace/components/IntroScreen.style.ts

View workflow job for this annotation

GitHub Actions / Lint and Unit Test

'cva' is defined but never used. Allowed unused vars must match /^(js|Injectable|Controller|Get|Post|Put|Delete|Patch|Options|Head|All)$/u

export const IntroScreenContainer = css({
display: "flex",
zIndex: 50,
position: "fixed",
inset: 0,
justifyContent: "center",
alignItems: "center",
backgroundImage: "linear-gradient(135deg, gray, green)",
backgroundSize: "cover",
transition: "opacity 0.5s ease-in-out",
});
10 changes: 3 additions & 7 deletions client/src/features/workSpace/components/IntroScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { LoadingSpinner } from "@components/loading/LoadingSpinner";
import { LoadingSpinner } from "@components/lotties/LoadingSpinner";
import { IntroScreenContainer } from "./IntroScreen.style";

export const IntroScreen = () => {
return (
<div
className="fixed inset-0 flex items-center justify-center bg-white z-50"
style={{
transition: "opacity 0.5s ease-in-out",
}}
>
<div className={IntroScreenContainer}>
<LoadingSpinner size={200} />
</div>
);
Expand Down

0 comments on commit 2c2ecac

Please sign in to comment.