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

[FE][FEAT] #134 : Layout Component 구현 #137

Merged
merged 11 commits into from
Nov 12, 2024
33 changes: 33 additions & 0 deletions frontend/src/component/Layout/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import classNames from 'classnames';
import { buttonActiveType } from './enumTypes';

interface IFooterProps {
title?: string;
onClick?: () => void;
active?: boolean;
}

export const Footer = (props: IFooterProps) => {
const buttonStyle = props.active ? buttonActiveType.ACTIVE : buttonActiveType.PASSIVE;

return (
<footer className="absolute bottom-5 w-[95%] h-[6%]">
effozen marked this conversation as resolved.
Show resolved Hide resolved
<button
className={classNames(
'w-full',
'h-full',
'bg-white',
'text-black',
'p-2',
'rounded-lg',
buttonStyle,
)}
type="button"
onClick={props.onClick}
>
{props.title}
</button>
</footer>
);
};
31 changes: 31 additions & 0 deletions frontend/src/component/Layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { ReactElement } from 'react';
import classNames from 'classnames';
import { backgroundType } from './enumTypes';

interface IHeaderProps {
title?: string;
isTransparency?: boolean;
buttonElement?: ReactElement;
}

export const Header = (props: IHeaderProps) => {
const background = props.isTransparency ? backgroundType.TRANSPARENCY : backgroundType.WHITE;

return (
<header
className={classNames(
'w-full',
'h-16',
'p-4',
'flex ',
'items-center ',
'text-black ',
'gap-[16px]',
background,
)}
>
{props.buttonElement}
<h1 className="text-base">{props.title}</h1>
</header>
);
};
37 changes: 37 additions & 0 deletions frontend/src/component/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { ReactElement } from 'react';
import classNames from 'classnames';
import { Header } from './Header';
import { Footer } from './Footer';

interface ILayoutProps {
children: ReactElement;
headerTitle?: string;
footerTitle?: string;
isHeaderTransparent?: boolean;
footerActive?: boolean;
headerButton?: ReactElement;
handleFooterClick?: () => void;
}

export const Layout = (props: ILayoutProps) => (
<div
className={classNames('flex', 'flex-col', 'items-center', 'w-full', 'h-full', 'bg-gray-400')}
>
{/* Header */}
<Header
title={props.headerTitle}
isTransparency={props.isHeaderTransparent}
buttonElement={props.headerButton}
/>

{/* Main content */}
<main>{props.children}</main>

{/* Footer */}
<Footer
title={props.footerTitle}
onClick={props.handleFooterClick}
active={props.footerActive}
/>
</div>
);
9 changes: 9 additions & 0 deletions frontend/src/component/Layout/enumTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export enum buttonActiveType {
'ACTIVE' = 'shadow-float text-gray-900',
'PASSIVE' = 'shadow-basic text-gray-400',
}

export enum backgroundType {
'TRANSPARENCY' = '',
'WHITE' = 'bg-white',
}
6 changes: 5 additions & 1 deletion frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
grayscale: {
white: '#FFFFFF',
50: 'rgba(60, 60, 67, 0.36)',
100: '#EDF2F7',
100: '#B7B7B7',
200: '#6D6D6D',
400: '#555555',
800: '#3E3E3E',
Expand Down Expand Up @@ -43,6 +43,10 @@ module.exports = {
'5xl': '3rem',
'6xl': '4rem',
},
boxShadow: {
float: '0 4px 20px rgba(0, 0, 0, 0.13)',
basic: 'inset 0 0 3px rgba(0, 0, 0, 0.11)',
},
}, // 필요한 커스터마이징을 여기서 설정 가능
},
plugins: [],
Expand Down
Loading