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] 전체 참여자 BottomSheet 내부 디자인 퍼블리싱 #228

Merged
merged 11 commits into from
Aug 8, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {css} from '@emotion/react';

export const InputAndDeleteButtonContainer = () =>
css({
display: 'flex',
alignItems: 'center',
width: '100%',
gap: '1rem',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {Icon, IconButton, LabelGroupInput} from 'haengdong-design';

import {InputAndDeleteButtonContainer} from './InputAndDeleteButton.style';

const InputAndDeleteButton = () => {
return (
<div css={InputAndDeleteButtonContainer}>
<div css={{flexGrow: 1}}>
<LabelGroupInput.Element elementKey="e" />
</div>
<IconButton variants="tertiary" size="medium">
<Icon iconType="trash" iconColor="onTertiary" />
</IconButton>
</div>
);
};

export default InputAndDeleteButton;
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {SetAllMemberListModal, SetInitialMemberListModal, SetActionListModal} from '@components/Modal/index';

interface ModalBasedOnMemberCountProps {
memberNameList: string[];
isOpenBottomSheet: boolean;
isOpenAllMemberListButton: boolean;
setOrder: React.Dispatch<React.SetStateAction<number>>;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenAllMemberListButton: React.Dispatch<React.SetStateAction<boolean>>;
}

const ModalBasedOnMemberCount = ({
memberNameList,
isOpenBottomSheet,
isOpenAllMemberListButton,
setOrder,
setIsOpenBottomSheet,
setIsOpenAllMemberListButton,
}: ModalBasedOnMemberCountProps) => {
if (isOpenAllMemberListButton) {
return (
<SetAllMemberListModal
setIsOpenBottomSheet={setIsOpenBottomSheet}
isOpenBottomSheet={isOpenBottomSheet}
setIsOpenAllMemberListButton={setIsOpenAllMemberListButton}
/>
);
}
switch (memberNameList.length) {
case 0:
return (
<SetInitialMemberListModal setIsOpenBottomSheet={setIsOpenBottomSheet} isOpenBottomSheet={isOpenBottomSheet} />
);

default:
return (
<SetActionListModal
setOrder={setOrder}
setIsOpenBottomSheet={setIsOpenBottomSheet}
isOpenBottomSheet={isOpenBottomSheet}
/>
);
}
};

export default ModalBasedOnMemberCount;
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import useDynamicBillActionInput from '@hooks/useDynamicBillActionInput';
import style from './AddBillActionListModalContent.style';

interface AddBillActionListModalContentProps {
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setOrder: React.Dispatch<React.SetStateAction<number>>;
}

const AddBillActionListModalContent = ({setOpenBottomSheet, setOrder}: AddBillActionListModalContentProps) => {
const AddBillActionListModalContent = ({setIsOpenBottomSheet, setOrder}: AddBillActionListModalContentProps) => {
const {
inputPairList,
inputRefList,
Expand All @@ -28,7 +28,7 @@ const AddBillActionListModalContent = ({setOpenBottomSheet, setOrder}: AddBillAc

// TODO: (@weadie) 요청 실패시 오류 핸들 필요
addBill(getFilledInputPairList().map(({title, price}) => ({title, price: Number(price)}))); // TODO: (@weadie) DTO같은게 다이내믹에 필요할까?
setOpenBottomSheet(false);
setIsOpenBottomSheet(false);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import style from './AddMemberActionListModalContent.style';

interface AddMemberActionListModalContentProps {
inOutAction: MemberType;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const AddMemberActionListModalContent = ({inOutAction, setOpenBottomSheet}: AddMemberActionListModalContentProps) => {
const AddMemberActionListModalContent = ({inOutAction, setIsOpenBottomSheet}: AddMemberActionListModalContentProps) => {
const {
inputList,
inputRefList,
Expand All @@ -30,7 +30,7 @@ const AddMemberActionListModalContent = ({inOutAction, setOpenBottomSheet}: AddM

const handleUpdateMemberListSubmit = () => {
updateMemberList({memberNameList: getFilledInputList().map(({value}) => value), type: inOutAction});
setOpenBottomSheet(false);
setIsOpenBottomSheet(false);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import style from './SetActionListModal.style';
export type ActionType = '지출' | '인원';

interface SetActionModalContentProps {
openBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
isOpenBottomSheet: boolean;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setOrder: React.Dispatch<React.SetStateAction<number>>;
}

const SetActionListModal = ({openBottomSheet, setOpenBottomSheet, setOrder}: SetActionModalContentProps) => {
const SetActionListModal = ({isOpenBottomSheet, setIsOpenBottomSheet, setOrder}: SetActionModalContentProps) => {
const [action, setAction] = useState<ActionType>('지출');
const [inOutAction, setInOutAction] = useState<InOutType>('탈주');

Expand All @@ -28,7 +28,7 @@ const SetActionListModal = ({openBottomSheet, setOpenBottomSheet, setOrder}: Set
};

return (
<BottomSheet isOpened={openBottomSheet} onClose={() => setOpenBottomSheet(false)}>
<BottomSheet isOpened={isOpenBottomSheet} onClose={() => setIsOpenBottomSheet(false)}>
<div css={style.container}>
<div css={style.switchContainer}>
<Switch value={action} onChange={handleActionTypeChange} values={['지출', '인원']} />
Expand All @@ -38,12 +38,12 @@ const SetActionListModal = ({openBottomSheet, setOpenBottomSheet, setOrder}: Set
</div>

{action === '지출' && (
<AddBillActionListModalContent setOpenBottomSheet={setOpenBottomSheet} setOrder={setOrder} />
<AddBillActionListModalContent setIsOpenBottomSheet={setIsOpenBottomSheet} setOrder={setOrder} />
)}
{action === '인원' && (
<AddMemberActionListModalContent
inOutAction={inOutAction === '탈주' ? 'OUT' : 'IN'}
setOpenBottomSheet={setOpenBottomSheet}
setIsOpenBottomSheet={setIsOpenBottomSheet}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {css} from '@emotion/react';

export const allMemberListModalStyle = () =>
Copy link
Contributor

Choose a reason for hiding this comment

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

이 파일의 스타일 명이 모두 긴데요.
저도 같은 문제가 있었어서 아래처럼 해결해보았습니다.
한번 보시고 맘에 든다면 써보시길 추천드립니다!

// 구현처
export const container = css({
  display: 'flex',
  flexDirection: 'column',
  width: '100%',
  height: '100%',
  padding: '0 1.5rem',
  gap: '1.5rem',
});

export const switchContainer = css({
  display: 'flex',
  width: '100%',
  justifyContent: 'space-between',
});

const setActionListModalStyle = {container, switchContainer};

export default setActionListModalStyle;

// 사용처
import style from './SetActionListModal.style';

return (
    ...
      <div css={style.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.

좋은 방법이네요! 축약하지 않으려고 길게 작성하게 되었는데.. 위 방법이 축약하지도 않고 좋네요!

css({
display: 'flex',
flexDirection: 'column',
gap: '1rem',
width: '100%',
height: '100%',
});

export const allMemberListModalTitleStyle = () =>
css({
display: 'flex',
justifyContent: 'space-between',
width: '100%',
padding: '0 1.5rem',
});

export const allMemberListModalLabelGroupInputStyle = () =>
css({
display: 'flex',
flexDirection: 'column',
padding: '0 1rem',
paddingBottom: '10rem',

overflow: 'auto',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {BottomSheet, Text, LabelGroupInput, FixedButton} from 'haengdong-design';

import InputAndDeleteButton from '@components/InputAndDeleteButton/InputAndDeleteButton';

import {
allMemberListModalLabelGroupInputStyle,
allMemberListModalStyle,
allMemberListModalTitleStyle,
} from './SetAllMemberListModal.style';

interface SetAllMemberListModalProps {
isOpenBottomSheet: boolean;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenAllMemberListButton: React.Dispatch<React.SetStateAction<boolean>>;
}

const SetAllMemberListModal = ({
isOpenBottomSheet,
setIsOpenBottomSheet,
setIsOpenAllMemberListButton,
}: SetAllMemberListModalProps) => {
const handleCloseAllMemberListModal = () => {
setIsOpenAllMemberListButton(prev => !prev);
setIsOpenBottomSheet(false);
};

return (
<BottomSheet isOpened={isOpenBottomSheet} onClose={handleCloseAllMemberListModal}>
<div css={allMemberListModalStyle}>
<div css={allMemberListModalTitleStyle}>
<Text size="bodyBold">전체 참여자 수정하기</Text>
{/* TODO: (@soha): 인원 텍스트 색 수정 필요 */}
Copy link
Contributor

Choose a reason for hiding this comment

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

빠르게 반영해서 노티드릴게요 ㅜㅜㅜㅜㅜ
문제점 알려주셔서 너무너무 감사합니다~!

<Text size="bodyBold" color="sematic">
총 N명
</Text>
</div>
<div css={allMemberListModalLabelGroupInputStyle}>
<LabelGroupInput labelText="이름">
<InputAndDeleteButton />
</LabelGroupInput>
</div>
<FixedButton children="수정 완료" />
</div>
</BottomSheet>
);
};

export default SetAllMemberListModal;
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
} from './SetInitialMemberListModal.style';

interface SetInitialMemberListProps {
openBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
isOpenBottomSheet: boolean;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const SetInitialMemberListModal = ({openBottomSheet, setOpenBottomSheet}: SetInitialMemberListProps) => {
const SetInitialMemberListModal = ({isOpenBottomSheet, setIsOpenBottomSheet}: SetInitialMemberListProps) => {
const {
inputList,
inputRefList,
Expand All @@ -30,11 +30,11 @@ const SetInitialMemberListModal = ({openBottomSheet, setOpenBottomSheet}: SetIni

const handleSubmit = () => {
updateMemberList({memberNameList: getFilledInputList().map(({value}) => value), type: 'IN'});
setOpenBottomSheet(false);
setIsOpenBottomSheet(false);
};

return (
<BottomSheet isOpened={openBottomSheet} onClose={() => setOpenBottomSheet(false)}>
<BottomSheet isOpened={isOpenBottomSheet} onClose={() => setIsOpenBottomSheet(false)}>
<div css={setInitialMemberListModalStyle}>
<Text size="bodyBold">초기 인원 설정하기</Text>
<div css={setInitialMemberListModalInputGroupStyle}>
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Modal/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export {default as SetActionListModal} from './SetActionModal/SetActionListModal';
export {default as SetInitialMemberListModal} from './SetInitialMemberListModal/SetInitialMemberListModal';
export {default as SetAllMemberListModal} from './SetAllMemberListModal/SetAllMemberListModal';
3 changes: 2 additions & 1 deletion client/src/components/StepList/BillStepItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import {PutAndDeleteBillActionModal} from '@components/Modal/SetActionModal/PutA
interface BillStepItemProps {
step: BillStep;
isOpenBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const BillStepItem: React.FC<BillStepItemProps> = ({step, isOpenBottomSheet, setOpenBottomSheet}) => {
const [clickedIndex, setClickedIndex] = useState(-1);

const totalPrice = step.actions.reduce((acc, cur) => acc + cur.price, 0);

const handleDragHandleItemClick = (index: number) => {
Expand Down
8 changes: 4 additions & 4 deletions client/src/components/StepList/MemberStepItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ import {DeleteMemberActionModal} from '@components/Modal/SetActionModal/DeleteMe
interface MemberStepItemProps {
step: MemberStep;
isOpenBottomSheet: boolean;
setOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
setIsOpenBottomSheet: React.Dispatch<React.SetStateAction<boolean>>;
}

const MemberStepItem: React.FC<MemberStepItemProps> = ({step, isOpenBottomSheet, setOpenBottomSheet}) => {
const MemberStepItem: React.FC<MemberStepItemProps> = ({step, isOpenBottomSheet, setIsOpenBottomSheet}) => {
return (
<>
<DragHandleItem
backgroundColor="white"
prefix={`${step.actions.map(({name}) => name).join(', ')} ${step.type === 'IN' ? '들어옴' : '나감'}`}
onClick={() => setOpenBottomSheet(prev => !prev)}
onClick={() => setIsOpenBottomSheet(prev => !prev)}
/>
{isOpenBottomSheet && (
<DeleteMemberActionModal
memberActionType={step.type}
memberActionList={step.actions}
isBottomSheetOpened={isOpenBottomSheet}
setIsBottomSheetOpened={setOpenBottomSheet}
setIsBottomSheetOpened={setIsOpenBottomSheet}
/>
)}
</>
Expand Down
10 changes: 7 additions & 3 deletions client/src/components/StepList/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ interface StepProps {
}

const Step = ({step}: StepProps) => {
const [isOpenBottomSheet, setOpenBottomSheet] = useState<boolean>(false);
const [isOpenBottomSheet, setIsOpenBottomSheet] = useState<boolean>(false);

if (step.type === 'BILL') {
return <BillStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setOpenBottomSheet={setOpenBottomSheet} />;
return (
<BillStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setIsOpenBottomSheet={setIsOpenBottomSheet} />
);
} else if (step.type === 'IN' || step.type === 'OUT') {
return <MemberStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setOpenBottomSheet={setOpenBottomSheet} />;
return (
<MemberStepItem step={step} isOpenBottomSheet={isOpenBottomSheet} setIsOpenBottomSheet={setIsOpenBottomSheet} />
);
} else {
return <></>;
}
Expand Down
8 changes: 7 additions & 1 deletion client/src/pages/EventPage/AdminPage/AdminPage.style.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import {css} from '@emotion/react';

export const ReceiptStyle = () =>
export const receiptStyle = () =>
css({
display: 'flex',
flexDirection: 'column',
gap: '8px',
padding: '0 8px',
paddingBottom: '8.75rem',
});

export const titleAndListButtonContainerStyle = () =>
css({
display: 'flex',
flexDirection: 'column',
});
Comment on lines +13 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

@jinhokim98 : 이부분은 Flex component를 사용할 수 있지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

해당 부분은 Flex를 사용할 수가 없습니댱!

Loading
Loading