Skip to content

Commit

Permalink
feat: AppLayout 컴포넌트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
bytrustu committed Feb 29, 2024
1 parent d222dd1 commit 6623bb4
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const App = () => <div>Hello, React Payments</div>;
import { AppLayout } from 'src/components/AppLayout';

const App = () => (
<AppLayout>
<div>Hello, React Payments</div>
</AppLayout>
);

export default App;
35 changes: 35 additions & 0 deletions src/components/AppLayout/AppLayout.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { Meta, StoryObj } from '@storybook/react';
import { AppLayout } from '@/components/AppLayout/AppLayout.tsx';
import { HStack, VStack } from '@/shared/components';
import { styleToken } from '@/shared/styles';

const meta = {
title: 'Components/AppLayout',
component: AppLayout,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
} satisfies Meta<typeof AppLayout>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Primary: Story = {
args: {
children: (
<VStack gap="20px" alignItems="center" justifyContent="center">
<HStack backgroundColor={styleToken.color.gray100} width="100%" justifyContent="space-between" padding="10px">
<div>Left</div>
<div>Right</div>
</HStack>
<VStack backgroundColor={styleToken.color.gray200} width="100%" padding="10px">
<div>App Item 1</div>
<div>App Item 2</div>
<div>App Item 3</div>
</VStack>
</VStack>
),
},
};
26 changes: 26 additions & 0 deletions src/components/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { PropsWithChildren } from 'react';
import { Box, VStack } from '@/shared/components';
import { styleToken } from '@/shared/styles';

export const AppLayout = ({ children }: PropsWithChildren) => (
<Box
as="section"
backgroundColor={styleToken.color.white}
width="375px"
minWidth="375px"
height="700px"
position="relative"
borderRadius="15px"
border={`1px solid ${styleToken.color.body}`}
>
<AppLayoutDisplay>{children}</AppLayoutDisplay>
</Box>
);

const AppLayoutDisplay = ({ children }: PropsWithChildren) => (
<VStack as="section" height="100%" padding="16px 24px">
{children}
</VStack>
);

AppLayout.displayName = 'AppLayout';
1 change: 1 addition & 0 deletions src/components/AppLayout/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './AppLayout.tsx';
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './AppLayout';
4 changes: 3 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import App from '@/App.tsx';
import { GlobalStyles } from '@/shared/styles';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<GlobalStyles />
<App />
</React.StrictMode>,
);

0 comments on commit 6623bb4

Please sign in to comment.