Skip to content
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
5 changes: 0 additions & 5 deletions src/components/layout/footer.tsx

This file was deleted.

20 changes: 20 additions & 0 deletions src/components/layout/frame/frame.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
interface FrameProps {
title: string;
content: string;
}

const Frame = ({ title, content }: FrameProps) => {
return (
<>
<section className='flex flex-col gap-4 px-3 py-10 tablet:px-8 tablet:py-[60px] desktop:px-[237px] desktop:py-[60px]'>
Copy link
Contributor

Choose a reason for hiding this comment

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

desktop:px-[237px] 이부분은 container로 만들면 될것같습니다 !
container 아예 유동적으로 사용할 수 있도록 조금 변경해둘게요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 알겠습니다~!

<h1 className='text-xl font-bold tablet:text-[28px]'>{title}</h1>
<div className='flex flex-col items-center justify-center gap-4 rounded-xl border border-solid border-gray-200 px-6 py-[60px]'>
<h2 className='text-sm font-normal tablet:text-base'>{content}</h2>
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

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

이부분 제가 미쳐 못봤었는데 font-size 관련 tailwind config 에 전부 등록되어있습니다 !
스토리북에서도 확인가능합니다 :)

text-heading-l = 28px 이런식으로 작성하시면 됩니다!

{/* 버튼 컴포넌트 넣을 자리 */}
</div>
</section>
</>
);
};

export default Frame;
Empty file.
30 changes: 0 additions & 30 deletions src/components/ui/frame.tsx

This file was deleted.

Empty file.
58 changes: 58 additions & 0 deletions src/context/toastContext/toastContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { createContext, ReactNode, useContext, useEffect, useState } from 'react';
import { createPortal } from 'react-dom';

interface ToastContextType {
showToast: (message: string) => void;
}

const ToastContext = createContext<ToastContextType | null>(null);

export const useToast = () => {
const ctx = useContext(ToastContext);
if (!ctx) throw new Error('useToast 는 Provider 안에서 사용해주세요');
return ctx;
};

const ToastProvider = ({ children }: { children: ReactNode }) => {
const [message, setMessage] = useState<string | null>(null);

const showToast = (msg: string) => {
setMessage(msg);
};

useEffect(() => {
if (!message) return;

const timer = setTimeout(() => {
setMessage(null);
}, 3000);

return () => {
clearTimeout(timer);
};
});

const toastRoot = typeof window !== 'undefined' ? document.getElementById('toast-root') : null;

return (
<>
<ToastContext.Provider value={{ showToast }}>
{children}
{toastRoot &&
createPortal(
message ? (
<div
role='alert'
className='fixed bottom-28 left-1/2 -translate-x-1/2 rounded-[5px] bg-red-300 px-4 py-[10px] text-white'
>
{message}
</div>
) : null,
toastRoot
)}
</ToastContext.Provider>
</>
);
};

export default ToastProvider;
3 changes: 2 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Container, Header, Wrapper } from '@/components/layout';
import ToastProvider from '@/context/toastContext/toastContext';
import '@/styles/fonts.css';
import '@/styles/globals.css';
import type { NextPage } from 'next';
Expand Down Expand Up @@ -29,7 +30,7 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
<link rel='icon' href='/favicon.ico' sizes='any' />
<link rel='icon' href='/favicon.png' type='image/png' sizes='192x192' />
</Head>
{getLayout(<Component {...pageProps} />)}
<ToastProvider>{getLayout(<Component {...pageProps} />)}</ToastProvider>
</>
);
}
1 change: 1 addition & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function Document() {
<Head />
<body className='antialiased'>
<Main />
<div id='toast-root'></div>
<NextScript />
</body>
</Html>
Expand Down