Skip to content

Commit

Permalink
[#65] refactor: NoService 컴포넌트 생성 및 분리
Browse files Browse the repository at this point in the history
서비스가 없음을 표시하는 컴포넌트가 다른 곳에서도 쓰일 일이 있어서 분리
  • Loading branch information
Seogeurim committed Dec 28, 2021
1 parent 6394494 commit 7899a06
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
16 changes: 16 additions & 0 deletions src/components/service/NoService/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { FC } from 'react';

import emptyImg from '@/assets/images/empty.png';

import { emptyStyle } from './style';

const NoService: FC = () => {
return (
<div css={emptyStyle}>
<img src={emptyImg} alt="empty" />
<p>There are no services</p>
</div>
);
};

export default NoService;
16 changes: 16 additions & 0 deletions src/components/service/NoService/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { SerializedStyles, Theme, css } from '@emotion/react';

export const emptyStyle = (theme: Theme): SerializedStyles => css`
text-align: center;
img {
width: 320px;
}
p {
font-family: ${theme.fontCoding};
font-size: 20px;
color: ${theme.colorPrimary};
margin-top: 5px;
}
`;
10 changes: 3 additions & 7 deletions src/components/service/ServiceList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { FC } from 'react';

import emptyImg from '@/assets/images/empty.png';

import NoService from '../NoService';
import ServiceItem from '../ServiceItem';
import { emptyStyle, headerStyle, listStyle, wrapperStyle } from './style';
import { headerStyle, listStyle, wrapperStyle } from './style';

type ServiceListProps = {
serviceCount: number;
Expand Down Expand Up @@ -44,10 +43,7 @@ const ServiceList: FC<ServiceListProps> = ({
</div>
</>
) : (
<div css={emptyStyle}>
<img src={emptyImg} alt="empty" />
<p>There are no services</p>
</div>
<NoService />
)}
</section>
);
Expand Down
15 changes: 0 additions & 15 deletions src/components/service/ServiceList/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,3 @@ export const listStyle = css`
flex-direction: column;
align-items: center;
`;

export const emptyStyle = (theme: Theme): SerializedStyles => css`
text-align: center;
img {
width: 320px;
}
p {
font-family: ${theme.fontCoding};
font-size: 20px;
color: ${theme.colorPrimary};
margin-top: 5px;
}
`;

0 comments on commit 7899a06

Please sign in to comment.