Skip to content

Commit

Permalink
Merge branch 'fe-dev' into feature/#623
Browse files Browse the repository at this point in the history
  • Loading branch information
soi-ha committed Sep 26, 2024
2 parents 9871ba7 + 19b91a5 commit 7313da9
Show file tree
Hide file tree
Showing 47 changed files with 309 additions and 299 deletions.
4 changes: 2 additions & 2 deletions client/src/components/AmountInput/AmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const AmountInput = ({value, onClick, underlined, activated}: Props) => {
`}
onClick={onClick}
>
<Text size="head" textColor={value !== '0' ? 'black' : 'gray'}>
{value}
<Text size="head" textColor={value !== '' && value !== '0' ? 'black' : 'gray'}>
{value === '' ? '0' : value}
</Text>
<Text
textColor="gray"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ import {css} from '@emotion/react';
export const chipGroupStyle = css({
display: 'flex',
gap: '0.25rem',
flexWrap: 'wrap',
overflow: 'hidden',
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const FixedButton: React.FC<FixedButtonProps> = forwardRef<HTMLButtonElem
{...htmlProps}
>
{variants === 'loading' ? (
<Lottie animationData={loadingAnimation} loop={true} style={{width: 240, height: 20}} />
<Lottie animationData={loadingAnimation} loop={true} style={{height: '1.25rem'}} />
) : (
children
)}
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Design/components/Icon/Icon.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const ICON_DEFAULT_COLOR: Record<IconType, IconColor> = {
toss: 'white',
meatballs: 'black',
editPencil: 'gray',
heundeut: 'gray',
};

export const iconStyle = ({iconType, theme, iconColor}: IconStylePropsWithTheme) => {
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/Design/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import X from '@assets/image/x.svg';
import PencilMini from '@assets/image/pencil_mini.svg';
import Meatballs from '@assets/image/meatballs.svg';
import EditPencil from '@assets/image/editPencil.svg';
import Heundeut from '@assets/image/heundeut.svg';
import {IconProps} from '@HDcomponents/Icon/Icon.type';
import {useTheme} from '@theme/HDesignProvider';

Expand All @@ -34,6 +35,7 @@ const ICON = {
toss: <img src={Toss} width="16" height="16" alt="toss icon" />,
meatballs: <Meatballs />,
editPencil: <EditPencil />,
heundeut: <Heundeut />,
};

export const Icon: React.FC<IconProps> = ({iconColor, iconType, ...htmlProps}: IconProps) => {
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Design/components/Icon/Icon.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export type IconType =
| 'pencilMini'
| 'toss'
| 'meatballs'
| 'editPencil';
| 'editPencil'
| 'heundeut';

export type IconColor = ColorKeys;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import {css} from '@emotion/react';
import {createPortal} from 'react-dom';
import {useEffect, useRef} from 'react';

import {useTheme} from '@components/Design/theme/HDesignProvider';

import FixedButton from '../FixedButton/FixedButton';

import NumberKeyboard, {NumberKeyboardProps} from './NumberKeyboard';
import useNumberKeyboardBottomSheet from './useNumberKeyboardBottomSheet';

interface Props extends NumberKeyboardProps {
isOpened?: boolean;
isOpened: boolean;
onClose: () => void;
}

const NumberKeyboardBottomSheet = ({isOpened, onClose, ...props}: Props) => {
const {theme} = useTheme();
const {bottomSheetRef} = useNumberKeyboardBottomSheet({isOpened});

return createPortal(
<div
ref={bottomSheetRef}
css={css`
position: fixed;
padding-bottom: 6.25rem;
Expand All @@ -26,6 +31,8 @@ const NumberKeyboardBottomSheet = ({isOpened, onClose, ...props}: Props) => {
gap: 1rem;
bottom: 0;
background-color: ${theme.colors.white};
z-index: 20;
touch-action: none;
transform: ${isOpened ? 'translate3d(0, 0, 0)' : 'translate3d(0, 100%, 0)'};
transition: 0.2s ease-in-out;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {useEffect, useRef} from 'react';

interface Props {
isOpened: boolean;
}

const useNumberKeyboardBottomSheet = ({isOpened}: Props) => {
const bottomSheetRef = useRef<HTMLDivElement>(null);

useEffect(() => {
const bottomSheet = bottomSheetRef.current;
if (!bottomSheet) return;

const preventScroll = (e: TouchEvent) => {
if (bottomSheet.contains(e.target as Node)) {
e.preventDefault();
}
};

if (isOpened) {
document.addEventListener('touchmove', preventScroll, {passive: false});
}

return () => {
document.removeEventListener('touchmove', preventScroll);
};
}, [isOpened]);

return {bottomSheetRef};
};

export default useNumberKeyboardBottomSheet;
35 changes: 0 additions & 35 deletions client/src/components/Design/components/Switch/Switch.stories.tsx

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions client/src/components/Design/components/Switch/Switch.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions client/src/components/Design/components/Switch/Switch.type.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @jsxImportSource @emotion/react */
import {forwardRef} from 'react';

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

import Text from '../Text/Text';

import {TextButtonProps} from './TextButton.type';
Expand All @@ -11,8 +9,6 @@ export const TextButton: React.FC<TextButtonProps> = forwardRef<HTMLButtonElemen
{textColor, textSize, children, ...htmlProps}: TextButtonProps,
ref,
) {
const {theme} = useTheme();

return (
<button ref={ref} {...htmlProps}>
<Text size={textSize} textColor={textColor}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {TextSize} from '../Text/Text.type';

export type TextColor = 'black' | 'gray';
export type TextColor = 'black' | 'gray' | 'onTertiary';

export interface TextButtonStyleProps {
textColor: TextColor;
Expand Down
20 changes: 0 additions & 20 deletions client/src/components/Design/components/TopNav/Back.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {css} from '@emotion/react';

export const navItemStyle = css({
padding: '0 0.5rem',

':first-of-type': {
paddingLeft: 0,
},
});
55 changes: 55 additions & 0 deletions client/src/components/Design/components/TopNav/NavItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/** @jsxImportSource @emotion/react */
import type {NavItemProps} from './NavItem.type';

import {useLocation, useNavigate} from 'react-router-dom';

import getDeletedLastPath from '@utils/getDeletedLastPath';

import TextButton from '../TextButton/TextButton';

import {navItemStyle} from './NavItem.style';

const NavItem = ({displayName, routePath, onHandleRouteInFunnel, noEmphasis = false, children}: NavItemProps) => {
const navigate = useNavigate();
const location = useLocation();
const matchPath = location.pathname.includes(routePath);

const handleNavigation = () => {
if (onHandleRouteInFunnel) {
onHandleRouteInFunnel();
return;
}

switch (routePath) {
case '/':
navigate('/');
break;
case '-1':
navigate(-1);
break;
default:
navigate(`${getDeletedLastPath(location.pathname)}${routePath}`);
break;
}
};

const getTextColor = () => {
if (noEmphasis) return 'gray';

return matchPath ? 'onTertiary' : 'gray';
};

return (
<li css={navItemStyle} onClick={handleNavigation}>
{children ? (
children
) : (
<TextButton textColor={getTextColor()} textSize="bodyBold">
{displayName}
</TextButton>
)}
</li>
);
};

export default NavItem;
14 changes: 14 additions & 0 deletions client/src/components/Design/components/TopNav/NavItem.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type NavItemOptionProps = {
displayName?: string;
onHandleRouteInFunnel?: () => void;
};

export type NavItemRequireProps = {
routePath: string;
};

export type NavItemStyleProps = {
noEmphasis?: boolean;
};

export type NavItemProps = NavItemRequireProps & NavItemOptionProps & NavItemStyleProps & React.PropsWithChildren;
50 changes: 0 additions & 50 deletions client/src/components/Design/components/TopNav/TopNav.stories.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,3 @@ export const topNavStyle = css({
padding: '0 1rem',
width: '100%',
});

export const topNavNonStyle = css({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '0 1rem',
width: '100%',
height: '1.5rem',
});
Loading

0 comments on commit 7313da9

Please sign in to comment.