Skip to content

Commit

Permalink
feat: v0.1.18 배포
Browse files Browse the repository at this point in the history
  • Loading branch information
Todari committed Jul 23, 2024
1 parent c0d85c3 commit 29bfb4c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 12 deletions.
4 changes: 2 additions & 2 deletions HDesign/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion HDesign/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haengdong-design",
"version": "0.1.6",
"version": "0.1.18",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down
1 change: 0 additions & 1 deletion HDesign/src/components/Input/Input.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const inputBoxStyle = (theme: Theme, inputType: InputType = 'input') =>
css({
display: 'flex',
justifyContent: 'space-between',
marginInline: '1rem',
padding: '0.75rem 1rem',
borderRadius: '1rem',
backgroundColor: inputBoxBackgroundColorByInputType(theme, inputType),
Expand Down
8 changes: 4 additions & 4 deletions HDesign/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const Switch = ({value, values, onChange}: SwitchProps) => {

return (
<div css={switchContainerStyle}>
{values.map((value, index) => (
{values.map((item, index) => (
<TextButton
key={`${index}_${value}`}
textColor={selectedValue === value ? 'black' : 'gray'}
key={`${index}_${item}`}
textColor={selectedValue === item ? 'black' : 'gray'}
textSize="bodyBold"
onClick={() => handleClick(index)}
>
{value}
{item}
</TextButton>
))}
</div>
Expand Down
14 changes: 10 additions & 4 deletions HDesign/src/components/TopNav/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ import TextButton from '../TextButton/TextButton';
import {topNavNonStyle, topNavStyle} from './TopNav.style';
import {TopNavProps} from './TopNav.type';
import Switch from '../Switch/Switch';
import {useEffect, useState} from 'react';

// TODO: (@todari) navigation으둜 인해 storybook λ™μž‘ν•˜μ§€ μ•ŠλŠ” 였λ₯˜ 해결해야함
// + νŽ˜μ΄μ§€ μ •ν•˜λŠ” 것에 따라, navigate 경둜 μˆ˜μ •ν•΄ μ€˜μ•Ό 함
const TopNav = ({navType}: TopNavProps) => {
const [nav, setNav] = useState('ν™ˆ');
const navigate = useNavigate();
const currentPath = useLocation().pathname;
const location = useLocation();

useEffect(() => {
navigate(PATH_TABLE[nav]);
}, [nav]);

const PATH_TABLE: Record<string, string> = {
ν™ˆ: `${currentPath}/`,
관리: `${currentPath}/admin`,
ν™ˆ: '/',
관리: '/admin',
};

const TopNavByType = () => {
Expand All @@ -30,7 +36,7 @@ const TopNav = ({navType}: TopNavProps) => {
case 'home':
return (
<div css={topNavStyle}>
<Switch value="ν™ˆ" values={['ν™ˆ', '관리']} onChange={value => navigate(PATH_TABLE[value])}></Switch>{' '}
<Switch value={nav} values={['ν™ˆ', '관리']} onChange={value => setNav(value)}></Switch>{' '}
</div>
);

Expand Down
2 changes: 2 additions & 0 deletions HDesign/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Title from '@components/Title/Title';
import TopNav from '@components/TopNav/TopNav';

import {MainLayout} from '@layouts/MainLayout';
import {ContentLayout} from '@layouts/ContentLayout';

import {HDesignProvider} from '@theme/HDesignProvider';

Expand All @@ -41,5 +42,6 @@ export {
Title,
TopNav,
MainLayout,
ContentLayout,
HDesignProvider,
};
23 changes: 23 additions & 0 deletions HDesign/src/layouts/ContentLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {PropsWithChildren} from 'react';
import {Flex} from '..';
type ContentLayoutBackground = 'white' | 'gray';

interface ContentLayoutProps extends PropsWithChildren {
backgroundColor?: ContentLayoutBackground;
}

export const ContentLayout = ({backgroundColor, children}: ContentLayoutProps) => {
return (
<Flex
backgroundColor={backgroundColor}
justifyContent="flexStart"
flexDirection="column"
padding="0 1rem"
gap="1rem"
width="100%"
height="100%"
>
{children}
</Flex>
);
};

0 comments on commit 29bfb4c

Please sign in to comment.