Skip to content

Commit

Permalink
[Add] 회원가입 구현, propTypes 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujonglee committed Oct 24, 2019
1 parent a2f1ca5 commit f4731ec
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 211 deletions.
1 change: 1 addition & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"react-dom": "^16.10.2",
"react-icons": "^3.7.0",
"react-input-range": "^1.3.0",
"react-loader-spinner": "^3.1.4",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"react-toastify": "^5.4.0",
Expand Down
4 changes: 3 additions & 1 deletion front/src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Button.defaultProps = {

Button.propTypes = {
text: PropTypes.string.isRequired,
full: PropTypes.bool
full: PropTypes.bool,
size: PropTypes.string,
color: PropTypes.string
};
export default Button;
10 changes: 10 additions & 0 deletions front/src/components/Calendar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import RangeCalendar from 'rc-calendar/lib/RangeCalendar';
import koKR from 'rc-calendar/lib/locale/ko_KR';
Expand Down Expand Up @@ -53,4 +54,13 @@ const Calendar = ({ close, date, setDate }) => {
);
};

Calendar.propTypes = {
close: PropTypes.func,
date: PropTypes.shape({
startDate: PropTypes.instanceOf(Date),
endDate: PropTypes.instanceOf(Date)
}),
setDate: PropTypes.func
};

export default Calendar;
20 changes: 11 additions & 9 deletions front/src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from 'styled-components';
import { gql } from 'apollo-boost';
import { FaAirbnb } from 'react-icons/fa';
import PropTypes from 'prop-types';
import { useMutation, useQuery } from 'react-apollo';
import { useMutation, useQuery } from '@apollo/react-hooks';
import { Link } from 'react-router-dom';
import Loader from './Loader';

Expand All @@ -28,6 +28,12 @@ const Container = styled.div`
padding: 0.3rem 0rem;
`;

const LoadContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
`;

const Column = styled.div`
display: flex;
justify-content: center;
Expand Down Expand Up @@ -79,9 +85,9 @@ const Header = ({ isLoggedIn }) => {
if (loading)
return (
<Wrapper>
<Container>
<LoadContainer>
<Loader />
</Container>
</LoadContainer>
</Wrapper>
);
if (data)
Expand All @@ -94,12 +100,8 @@ const Header = ({ isLoggedIn }) => {
<Column>
{isLoggedIn ? (
<>
<LoggedText>
<span role="img" aria-label="smile">
{data.me.name} 😆
</span>
</LoggedText>
<LoggedText onClick={logout}> 로그아웃</LoggedText>
<LoggedText>{data.me.name} </LoggedText>
<LoggedText onClick={logout}>로그아웃</LoggedText>
</>
) : (
<Link to={'/'}>
Expand Down
18 changes: 14 additions & 4 deletions front/src/components/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@ const InputS = styled.input`
}
`;

const Input = ({ placeholder, size, type, ...rest }) => {
return <InputS placeholder={placeholder} size={size} type={type} {...rest} />;
const Input = ({ placeholder, size, type, required, ...rest }) => {
return (
<InputS
placeholder={placeholder}
size={size}
type={type}
{...rest}
required={required}
/>
);
};

Input.defaultProps = {
size: 'medium',
type: 'text'
type: 'text',
required: false
};

Input.propTypes = {
placeholder: PropTypes.string,
size: PropTypes.string,
type: PropTypes.string
type: PropTypes.string,
required: PropTypes.bool
};

export default Input;
5 changes: 5 additions & 0 deletions front/src/components/Personnel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import PersonnelRow from './PersonnelRow';
import {
Expand Down Expand Up @@ -100,4 +101,8 @@ const Personnel = ({ close }) => {
);
};

Personnel.propTypes = {
close: PropTypes.func.isRequired
}

export default React.memo(Personnel);
6 changes: 5 additions & 1 deletion front/src/components/PersonnelRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ const PersonnelRow = ({ text, age, value, increase, decrease }) => {
};

PersonnelRow.propTypes = {
text: PropTypes.string.isRequired
text: PropTypes.string.isRequired,
age: PropTypes.string,
value: PropTypes.number.isRequired,
increase: PropTypes.func.isRequired,
decrease: PropTypes.func.isRequired
};

export default React.memo(PersonnelRow);
6 changes: 6 additions & 0 deletions front/src/components/PriceBar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import propTypes from 'prop-types';
import styled from 'styled-components';
import InputRange from 'react-input-range';
import 'react-input-range/lib/css/index.css';
Expand Down Expand Up @@ -110,4 +111,9 @@ const PriceBar = ({ openDate, close }) => {
);
};

PriceBar.propTypes = {
openDate: propTypes.func.isRequired,
close: propTypes.func.isRequired
};

export default PriceBar;
14 changes: 13 additions & 1 deletion front/src/components/Room/RoomContainer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { gql } from 'apollo-boost';
import { useMutation } from 'react-apollo';
import { useMutation } from '@apollo/react-hooks';
import { useRoomState, useRoomDispatch } from '../../contexts/RoomsContext';
import {
usePersonnelState,
Expand Down Expand Up @@ -90,4 +91,15 @@ const RoomContainer = ({
);
};

RoomContainer.propTypes = {
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
rating: PropTypes.number,
imgPath: PropTypes.string.isRequired,
bed: PropTypes.number,
bathroom: PropTypes.number,
bedroom: PropTypes.number
};

export default RoomContainer;
170 changes: 0 additions & 170 deletions front/src/contexts/Room.js

This file was deleted.

Loading

0 comments on commit f4731ec

Please sign in to comment.