Skip to content

Commit

Permalink
refactor: BackwardButton -> BackwardIcon으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
365kim committed May 3, 2021
1 parent 4630b1f commit fe95865
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 47 deletions.
38 changes: 0 additions & 38 deletions src/components/BackwardButton/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/components/BackwardButton/style.css

This file was deleted.

30 changes: 30 additions & 0 deletions src/components/BackwardIcon/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable react/jsx-curly-brace-presence */
import React from 'react';
import PropTypes from 'prop-types';

export const BackwardIcon = ({ size, color, strokeWidth }) => {
return (
<svg viewBox={`0 0 ${size} ${size}`} height={size} width={size} fill="none">
<path
d={`
M ${size / 2} 1
L 1 ${size / 2}
L ${size / 2} ${size}`}
stroke={color}
strokeWidth={strokeWidth}
/>
</svg>
);
};

BackwardIcon.propTypes = {
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
strokeWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
color: PropTypes.string.isRequired,
};

BackwardIcon.defaultProps = {
size: 16,
strokeWidth: 1.5,
color: '#525252',
};
4 changes: 2 additions & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BackwardButton } from './BackwardButton';
import { BackwardIcon } from './BackwardIcon';
import { Button } from './Button';
import { Card } from './Card';
import { Circle } from './Circle';
Expand All @@ -11,4 +11,4 @@ import { Modal } from './Modal';
import { Text } from './Text';
import { Heading } from './Heading';

export { BackwardButton, Button, Card, Circle, CreditCardPreview, Container, Form, Input, Label, Modal, Text, Heading };
export { BackwardIcon, Button, Card, Circle, CreditCardPreview, Container, Form, Input, Label, Modal, Text, Heading };
7 changes: 5 additions & 2 deletions src/pages/AddPages/AddFormPage/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useState } from 'react';
import { BackwardButton, CreditCardPreview, Heading } from '../../../components';
import { Button, CreditCardPreview, Heading } from '../../../components';
import { CardInfoForm } from './CardInfoForm';
import { CardCompanySelectModal } from './CardCompanySelectModal';
import { getFormattedCardInfo } from '../../../cardInfoFormatter';
import './style.css';
import { BackwardIcon } from '../../../components/BackwardIcon';

export const AddFormPage = (props) => {
const { initialCardInfo, cardInfo, setCardInfo } = props;
Expand All @@ -14,7 +15,9 @@ export const AddFormPage = (props) => {
return (
<div className="AddFormPage">
<div className="AddFormPage__Heading">
<BackwardButton />
<Button className="AddFormPage__BackwardButton">
<BackwardIcon />
</Button>
<Heading>카드 추가</Heading>
</div>
<CreditCardPreview
Expand Down
6 changes: 6 additions & 0 deletions src/pages/AddPages/AddFormPage/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
align-items: center;
}

.AddFormPage__BackwardButton {
width: 1.25rem;
height: 1.25rem;
margin-right: 1.5rem;
}

/* 카드 정보 작성 폼 */

.CardInfoForm {
Expand Down

0 comments on commit fe95865

Please sign in to comment.