Skip to content

Commit

Permalink
✨ Feat: 버튼 클릭 시 새로고침
Browse files Browse the repository at this point in the history
  • Loading branch information
easyhyun00 committed May 9, 2024
1 parent b29e2c9 commit 756d9e1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
14 changes: 8 additions & 6 deletions src/components/LoadingError/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ import PropTypes from 'prop-types';
import style from './styles.module.scss';

/**
* @param {string} errorMessage
* @param {string} errorMessage 에러메시지 문구
*/
const LoadingError = ({ errorMessage }) => {
const handleRefresh = () => {
window.location.reload();
};

return (
<div className={style.error}>
<Logo />
{/* <Logo /> */}
<h3>문제가 발생했습니다</h3>
<p>{errorMessage}</p>
<div className={style.button}>
<CustomButton rounded btnText="페이지 새로고침" />
</div>
<CustomButton rounded btnText="페이지 새로고침" onClick={handleRefresh} />
</div>
);
};

LoadingError.propTypes = {
errorMessage: PropTypes.string,
errorMessage: PropTypes.string.isRequired,
};

export default LoadingError;
4 changes: 2 additions & 2 deletions src/components/LoadingError/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
white-space: pre-wrap;

h3 {
margin-top: 40px;
// margin-top: 45px;
@include font-base($color-brand-orange, 600, 18px, 26px);
}

p {
margin-bottom: 10px;
margin-bottom: 15px;
@include font-base($color-white, 600, 14px, 26px);
}

Expand Down
1 change: 0 additions & 1 deletion src/pages/ListPage/Donation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const Donation = () => {
return (
<section className={style.container}>
<h2 className={style.title}>후원을 기다리는 조공</h2>
{/* <LoadingError errorMessage="후원 목록을 가져오지 못했습니다. 다시 시도해주세요" /> */}
<Carousel customSettings={carouselSettings}>
{testData.list.map((item) => {
return <Card item={item} key={item.id} />;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ListPage/MonthlyChart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const MonthlyChart = () => {
name: '추가 버튼 눌렀구나',
totalVotes: 1000,
profilePicture:
'https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Fandom-K/idol/1714613892649/ive1.jpeg',
'https://sprint-fe-project.s3.ap-northeast-2.amazonaws.com/Fandom-K/idol/1714613892649/ive1.jpeg',
},
];
setIdolList(newArr);
Expand Down
3 changes: 3 additions & 0 deletions src/pages/TestPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ const TestPage = () => {
</div>
<div>
<LoadingError errorMessage="후원 목록을 가져오지 못했습니다. 다시 시도해주세요" />
<LoadingError
errorMessage={`이렇게 작성하면 줄바꿈이 됩니다.\n다시 시도해주세요`}
/>
</div>
</div>
);
Expand Down

0 comments on commit 756d9e1

Please sign in to comment.