Skip to content

Commit eca34b0

Browse files
authored
Merge pull request #172 from boostcampwm-2021/dev
NogariHouse Release v1.0.4
2 parents c389de9 + 692c2dd commit eca34b0

9 files changed

Lines changed: 58 additions & 47 deletions

File tree

client/src/assets/styles/global-styles.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ const GlobalStyle = createGlobalStyle`
3636
overflow: hidden;
3737
}
3838
39+
a {
40+
text-decoration: none;
41+
color: black;
42+
}
43+
3944
#root {
4045
position: relative;
4146
height: 100vh;

client/src/components/common/default-button/index.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@ import React from 'react';
22

33
import { CustomDefaultButton, DefaultButtonProps } from './style';
44

5-
function DefaultButton({
5+
const DefaultButton = React.memo(({
66
buttonType,
77
children,
88
size,
99
isDisabled,
1010
onClick,
1111
font,
12-
}: DefaultButtonProps) {
13-
return (
14-
<CustomDefaultButton
15-
type="button"
16-
buttonType={buttonType}
17-
size={size}
18-
disabled={isDisabled}
19-
onClick={onClick}
20-
font={font}
21-
>
22-
{children}
23-
</CustomDefaultButton>
24-
);
25-
}
12+
}: DefaultButtonProps) => (
13+
<CustomDefaultButton
14+
type="button"
15+
buttonType={buttonType}
16+
size={size}
17+
disabled={isDisabled}
18+
onClick={onClick}
19+
font={font}
20+
>
21+
{children}
22+
</CustomDefaultButton>
23+
));
2624

2725
export default DefaultButton;

client/src/components/event/card-list/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { MouseEvent } from 'react';
1+
import React from 'react';
22
import styled from 'styled-components';
33

44
import EventCard from '@components/event/card';
@@ -34,6 +34,6 @@ export const makeEventToCard = (event: EventCardProps) => (
3434
/>
3535
);
3636

37-
export default function EventCardList({ eventList, setEventModal }: { eventList: EventCardProps[], setEventModal: ((e: MouseEvent) => void) }) {
38-
return <EventDiv onClick={setEventModal}>{eventList.map(makeEventToCard)}</EventDiv>;
37+
export default function EventCardList({ eventList }: { eventList: EventCardProps[] }) {
38+
return <EventDiv>{eventList.map(makeEventToCard)}</EventDiv>;
3939
}

client/src/components/event/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import LoadingSpinner from '@styles/loading-spinner';
66
import EventCardList from '@components/event/card-list';
77
import useFetchItems from '@hooks/useFetchItems';
88
import useItemFecthObserver from '@hooks/useItemFetchObserver';
9-
import useSetEventModal from '@hooks/useSetEventModal';
109
import ObserverBlock from './style';
1110

1211
interface EventUser {
@@ -28,7 +27,6 @@ function EventView() {
2827
const [loading, setLoading] = useState(true);
2928
const nowFetching = useRecoilValue(nowFetchingState);
3029
const [targetRef] = useItemFecthObserver(loading);
31-
const setEventModal = useSetEventModal();
3230

3331
useEffect(() => {
3432
if (nowItemList && nowItemType === 'event') {
@@ -42,7 +40,7 @@ function EventView() {
4240

4341
return (
4442
<>
45-
<EventCardList setEventModal={setEventModal} eventList={nowItemList} />
43+
<EventCardList eventList={nowItemList} />
4644
<ObserverBlock ref={targetRef}>
4745
{nowFetching && <LoadingSpinner />}
4846
</ObserverBlock>

client/src/components/event/register-modal/style.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { ModalBox } from '@styles/modal';
44

55
export const CustomEventRegisterModal = styled(ModalBox)`
66
top: 15vh;
7-
flex-grow: 3;
87
display: flex;
98
flex-direction: column;
109
align-items: center;
11-
min-width: 500px;
10+
min-width: min(80vw,600px);
1211
min-height: 500px;
1312
padding: 0px;
1413
background-color:white;
1514
border-radius: 30px;
1615
background-color: #F1F0E4;
16+
margin-left: calc(50% - min(40vw, 300px));
1717
`;
1818

1919
export const ModalHeader = styled.div`

client/src/components/main/left-sidebar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface IActiveFollowingUser {
2020
isActive: boolean,
2121
}
2222

23-
function LeftSideBar() {
23+
const LeftSideBar = React.memo(() => {
2424
const user = useRecoilValue(userState);
2525
const followingList = useRecoilValue(followingListState);
2626
const setToastList = useSetRecoilState(toastListSelector);
@@ -100,6 +100,6 @@ function LeftSideBar() {
100100
))}
101101
</ActiveFollowingListWrapper>
102102
);
103-
}
103+
});
104104

105105
export default LeftSideBar;

client/src/components/main/right-sidebar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const RoomModalLayout = styled.div`
2727
2828
`;
2929

30-
function RightSideBar() {
30+
const RightSideBar = React.memo(() => {
3131
const roomView = useRecoilValue(roomViewType);
3232

3333
if (roomView === 'createRoomView') {
@@ -69,6 +69,6 @@ function RightSideBar() {
6969
}
7070

7171
return (<div>Error</div>);
72-
}
72+
});
7373

7474
export default RightSideBar;

client/src/components/room/new-view/index.tsx

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/* eslint-disable react/jsx-no-bind */
12
/* eslint-disable object-shorthand */
2-
import React, { useState, useRef } from 'react';
3+
import React, { useState, useRef, useCallback } from 'react';
34
import { useSetRecoilState, useRecoilValue } from 'recoil';
45

56
import roomDocumentIdState from '@atoms/room-document-id';
@@ -29,7 +30,7 @@ function RoomModal() {
2930
const [isAnonymous, setIsAnonymous] = useState(false);
3031
const inputRef = useRef<HTMLInputElement>(null);
3132

32-
const submitButtonHandler = async () => {
33+
const submitButtonHandler = useCallback(async () => {
3334
try {
3435
const roomInfo = {
3536
type: roomType,
@@ -50,7 +51,7 @@ function RoomModal() {
5051
if (error.name === 'NotAllowedError') setToastList(toastMessage.roomAllowMicDanger());
5152
else setToastList(toastMessage.roomCreateDanger());
5253
}
53-
};
54+
}, [roomType]);
5455

5556
const inputHandler = () => {
5657
setIsDisabled(!inputRef.current?.value);
@@ -64,38 +65,44 @@ function RoomModal() {
6465
setRoomType(checkBoxName);
6566
};
6667

67-
const randomlyAssignedHandler = async () => {
68+
const randomlyAssignedHandler = useCallback(async () => {
6869
const roomDocumentId = await getRandomRoomDocumentId();
6970
if (roomDocumentId === 'NO_ROOM') {
7071
setToastList(toastMessage.roomMatchingDanger());
7172
} else {
7273
setRoomDocumentId(roomDocumentId);
7374
setRoomView('selectModeView');
7475
}
75-
};
76+
}, []);
77+
78+
const CheckBoxs = React.memo(() => (
79+
<CheckboxLayout>
80+
<RoomTypeCheckBox checkBoxName="public" onClick={roomTypeHandler.bind(null, 'public')} roomType={roomType} />
81+
<RoomTypeCheckBox checkBoxName="closed" onClick={roomTypeHandler.bind(null, 'closed')} roomType={roomType} />
82+
</CheckboxLayout>
83+
));
84+
85+
const Buttons = React.memo(() => (
86+
<ButtonLayout>
87+
<DefaultButton buttonType="secondary" size="medium" onClick={submitButtonHandler} isDisabled={isDisabled}>
88+
Let&apos;s Go
89+
</DefaultButton>
90+
<DefaultButton buttonType="thirdly" size="medium" onClick={randomlyAssignedHandler}>
91+
Randomly assigned
92+
</DefaultButton>
93+
</ButtonLayout>
94+
));
7695

7796
return (
7897
<>
7998
<h2> Let&apos;s have fun together! </h2>
80-
<CheckboxLayout>
81-
{/* eslint-disable-next-line react/jsx-no-bind */}
82-
<RoomTypeCheckBox checkBoxName="public" onClick={roomTypeHandler.bind(null, 'public')} roomType={roomType} />
83-
{/* eslint-disable-next-line react/jsx-no-bind */}
84-
<RoomTypeCheckBox checkBoxName="closed" onClick={roomTypeHandler.bind(null, 'closed')} roomType={roomType} />
85-
</CheckboxLayout>
99+
<CheckBoxs />
86100
<AnonymousCheckBox checked={isAnonymous} onChange={checkboxHandler} roomType={roomType} text="Allow anonymous ?" />
87101
<CustomTitleForm>
88102
<TitleInputbarLabel>Add a Room Title</TitleInputbarLabel>
89103
<TitleInputbar ref={inputRef} onChange={inputHandler} data-testid="TitleInputbar" />
90104
</CustomTitleForm>
91-
<ButtonLayout>
92-
<DefaultButton buttonType="secondary" size="medium" onClick={submitButtonHandler} isDisabled={isDisabled}>
93-
Let&apos;s Go
94-
</DefaultButton>
95-
<DefaultButton buttonType="thirdly" size="medium" onClick={randomlyAssignedHandler}>
96-
Randomly assigned
97-
</DefaultButton>
98-
</ButtonLayout>
105+
<Buttons />
99106
</>
100107
);
101108
}

client/src/components/sign/common/style.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export const SignBody = styled.div`
55
position: relative;
66
display: flex;
77
flex-direction: column;
8-
justify-content: space-evenly;
98
align-items: center;
109
width: 100%;
1110
height: calc(100vh - 100px);
1211
${scrollbarStyle};
12+
13+
button {
14+
margin-top: 30px;
15+
}
1316
`;
1417

1518
export const TitleDiv = styled.div`

0 commit comments

Comments
 (0)