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

Main page/#97 #99

Merged
merged 11 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions app/(sub-page)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from 'next/image';
import background from '../../public/assets/background.png';
import NavigationBar from '../ui/view/molecule/navigation-bar';

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -8,6 +9,7 @@ interface LayoutProps {
function SubPageLayout({ children }: LayoutProps) {
return (
<>
<NavigationBar />
<Image src={background} width={800} height={288} className="w-full bg-white h-[18rem]" alt="background" />
<div className="flex justify-center">{children}</div>
</>
Expand Down
12 changes: 0 additions & 12 deletions app/__test__/page.test.tsx

This file was deleted.

6 changes: 2 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ export default function RootLayout({
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.css"
rel="stylesheet"
/>
<link href="https://webfontworld.github.io/vitro/VitroCore.css" rel="stylesheet" />
</head>
<body>
<div className="bg-white">
<Provider>
<MSWComponent>
<NavigationBar />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<NavigationBar />는 메인페이지에도 적용되어야하는 요소 같은데 (sub-page)의 layout으로 옮겨주신 이유가 무엇인가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main page에서는 전체 페이지를 감싸는 요소가 있는데 이 안에서 navigation bar가 존재해야 하기때문에 main page가 존재하지 않는 sub page의 layout으로 옮겨줬습니다!

{children}
</MSWComponent>
<MSWComponent>{children}</MSWComponent>
</Provider>
</div>
<Toaster />
Expand Down
55 changes: 46 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,51 @@
import Image from 'next/image';
import mainBookBackground from '../public/assets/main-book-background.png';
import mainMyongjiLogo from '../public/assets/main-myongji-logo.png';
import graduationCap from '../public/assets/graduation-cap.png';
import Responsive from './ui/responsive';
import NavigationBar from './ui/view/molecule/navigation-bar';
import Button from './ui/view/atom/button/button';
import Link from 'next/link';

export default function Home() {
export default function HomePage() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<Link
href="/dashboard"
className="flex items-center gap-5 self-start rounded-lg bg-blue-500 px-6 py-3 text-sm font-medium text-white transition-colors hover:bg-blue-400 md:text-base"
>
<span>dashboard</span>
</Link>
</main>
<div className="bg-primary w-[100vw] h-[100vh] overflow-hidden relative">
<NavigationBar />
<Responsive minWidth={768}>
<Image src={mainBookBackground} alt="main-book-background" className="fixed right-0 w-[60%] z-0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

width과 height를 지정하지않았는데 warning이 발생하지 않았나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 경고는 뜨지 않는데 혹시 문제가 될까요?

</Responsive>
<Image
src={mainMyongjiLogo}
alt="main-myongji-logo"
width={120}
height={120}
className="absolute top-24 right-4"
/>
<div className="relative h-full flex flex-col items-center justify-center gap-6 z-1">
<p className="text-center flex flex-col gap-4">
<div className="relative">
<div className="z-2 text-3xl font-bold sm:text-7xl relative text-white" style={{ fontFamily: 'VitroCore' }}>
<span className="text-etc-yellow" style={{ fontFamily: 'VitroCore' }}>
</span>
업을&nbsp;
<span className="text-etc-yellow" style={{ fontFamily: 'VitroCore' }}>
</span>
탁해
</div>
<Image
src={graduationCap}
alt="graduation-cap"
className="absolute bottom-2 left-8 sm:bottom-10 sm:left-[-24px] sm:w-[52px] sm:h-[52px] w-[36px] h-[36px]"
/>
</div>
<div className="text-md sm:text-lg text-gray-400 font-medium">명지인을 위한 간편 졸업요건 검사 사이트</div>
</p>
<Link href="/grade-upload">
<Button label="검사 시작" variant="dark" size="xl" />
</Link>
</div>
</div>
);
}
12 changes: 9 additions & 3 deletions app/ui/lecture/lecture-search/lecture-search.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Story = StoryObj<typeof meta>;

export const AddSenario: Story = {
play: async ({ step }) => {
await step('사용자가 추가를 클릭하면 lecture search drawer 창이 띄워진다', async () => {
await step('사용자가 과목 추가를 클릭하면 lecture search drawer 창이 띄워진다', async () => {
const toggleLectureSearch = await screen.findByTestId('toggle-lecture-search');
await userEvent.click(toggleLectureSearch);

Expand All @@ -67,14 +67,20 @@ export const AddSenario: Story = {
await delay(3000);
expect(addButton[0]).toBeDisabled();
});
await step('drawer 외부 overlay를 클릭하면 drawer가 닫힌다', async () => {
const drawerOverlay = await screen.findByTestId('drawer-overlay');
await userEvent.click(drawerOverlay);
const toggleLectureSearch = await screen.findByTestId('toggle-lecture-search');
expect(toggleLectureSearch).toBeInTheDocument();
});
Comment on lines +70 to +75
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • draw 닫는 시나리오를 추가하여 테스트 실패를 해결한 것 같은데, 시나리오마다 환경을 초기화하는 방법은 없었을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decorator를 사용해서 play 전에 특정 로직을 실행시킬 수 있습니다! 그래서 decorator에 play 전에 drawer를 닫는 로직을 넣어봤습니다.
drawer가 항상 존재하는 것은 아니기에 if( screen.findByTestId('drawer-overlay') ) 코드로 drawer 존재 여부에 따라 분기처리를 하려했는데 drawer-overlay element가 존재하지 않다고 오류를 뿜어버립니다. 현재로서 이 분기처리를 마땅히 해결 할 코드를 찾지 못했습니다 🥹
아직 중복되거나 큰 문제가 되지 않아서 추후에 중복이 되거나 이럴때 더 찾아봐도 될까요?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 아하 혹시나 스토리북에 있는 reset button처럼 이를 수동으로 트리거할 수 있는 API가 스토리북에서 제공되지 않을까 생각해서, 이에 대해 알고 있는지 궁금해서 질문했습니다.
  • 지금은 중복되거나 큰 문제가 되진 않으니 나중에 필요할 때 찾아보셔도 좋을 것 같습니다. 저도 찾아보겠습니다

},
};

export const SearchSenario: Story = {
play: async ({ step }) => {
await step('사용자가 추가를 클릭하면 lecture search drawer 창이 띄워진다', async () => {
await step('사용자가 과목 추가를 클릭하면 lecture search drawer 창이 띄워진다', async () => {
const toggleLectureSearch = await screen.findByTestId('toggle-lecture-search');
await userEvent.click(toggleLectureSearch);

const lectureSearch = await screen.findByTestId('lecture-search');
expect(lectureSearch).toBeInTheDocument();
});
Expand Down
7 changes: 5 additions & 2 deletions app/ui/view/atom/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { cva } from 'class-variance-authority';
import React from 'react';
import LoadingSpinner from '../loading-spinner';

export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'default';
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'default' | 'xl';

interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
label: string;
variant?: 'primary' | 'secondary' | 'text' | 'list' | 'outlined';
variant?: 'primary' | 'secondary' | 'text' | 'list' | 'outlined' | 'dark';
size?: ButtonSize;
loading?: boolean;
disabled?: boolean;
Expand All @@ -18,6 +18,7 @@ export const ButtonVariants = cva(`flex justify-center items-center`, {
variant: {
primary: 'bg-primary rounded-[100px] text-white border-0 hover:bg-primary-hover',
outlined: 'rounded-[100px] text-primary border-solid border-[1px] border-primary',
dark: 'bg-dark rounded-[100px] text-white border-0 hover:bg-dark-hover',
secondary: 'bg-white rounded-[100px] border-solid border-[1px] border-gray-6 hover:bg-white-hover',
text: 'font-medium text-slate-400 text-sm hover:text-slate-600',
list: 'py-1 px-3 bg-blue-500 rounded-[7px] text-white leading-5 font-medium text-base hover:bg-blue-500',
Expand All @@ -28,6 +29,7 @@ export const ButtonVariants = cva(`flex justify-center items-center`, {
sm: 'px-10 py-2.5 text-xs font-medium leading-3',
md: 'px-20 py-4 text-base font-medium leading-3',
lg: 'px-28 py-4 text-2xl font-medium leading-9',
xl: 'px-36 py-5 text-3xl font-medium leading-9',
},
},
});
Expand All @@ -40,6 +42,7 @@ export const LoadingIconVariants = cva('animate-spin shrink-0', {
sm: 'h-5 w-5 mr-1.5 -ml-1',
md: 'h-6 w-6 mr-1.5 -ml-1',
lg: 'h-12 w-12 mr-1.5 -ml-1',
xl: 'h-12 w-12 mr-1.5 -ml-1',
},
},
});
Expand Down
6 changes: 5 additions & 1 deletion app/ui/view/molecule/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const Drawer = ({ children, drawerKey, onClose, className }: DrawerProps) => {
return (
<DrawerPrimitive.Root open={isOpen} onClose={close}>
<DrawerPrimitive.Portal>
<DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/60" />
<DrawerPrimitive.Overlay
onClick={close}
className="fixed inset-0 z-50 bg-black/60"
data-testid="drawer-overlay"
/>
<DrawerPrimitive.Content
className={cn(
'fixed inset-x-0 bottom-0 z-50 mt-24 flex flex-col rounded-t-[10px] border border-slate-200 bg-white',
Expand Down
2 changes: 1 addition & 1 deletion app/ui/view/molecule/navigation-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import logo from '../../../../public/assets/logo.svg';

export default function NavigationBar() {
return (
<div className="absolute p-4 border-b-[1px] w-full">
<div className="absolute p-4 border-b-[1px] w-full z-1">
<Image className="md:h-10 h-7 w-[110px] md:w-[150px]" width={150} height={100} src={logo} alt="main-logo" />
</div>
);
Expand Down
Binary file added public/assets/graduation-cap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/main-book-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/main-myongji-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const config: Config = {
'white-hover': '#f3f4f6',
},
zIndex: {
1: '100', // upper layout
2: '200', // upper content
1: '100', // upper layout, navigation bar, main page content
2: '200', // upper content , main page graduation cap
3: '300', // upper all
},
gridTemplateColumns: {
Expand Down
Loading