Skip to content

Commit a6b032d

Browse files
authored
feat: optimize NotFound (#318)
* feat: optimize NotFound * docs: basic use --------- Co-authored-by: liuyi <> Co-authored-by: liuyi <[email protected]>
1 parent c4ef19a commit a6b032d

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { cleanup, render } from '@testing-library/react';
3+
import '@testing-library/jest-dom/extend-expect';
4+
import NotFound from '..';
5+
6+
describe('test NotFound', () => {
7+
afterEach(cleanup);
8+
9+
test('renders not found message', () => {
10+
const { getByText } = render(<NotFound />);
11+
const element = getByText(//i);
12+
expect(element).toBeInTheDocument();
13+
});
14+
});

src/notFound/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ demo:
1515
## 示例
1616

1717
```jsx
18+
/**
19+
* title: "基础使用"
20+
*/
1821
import React from 'react';
1922
import { NotFound } from 'dt-react-component';
2023

src/notFound/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import React from 'react';
2-
32
import { FrownOutlined } from '@ant-design/icons';
3+
import './style.scss';
4+
5+
const NotFound: React.FC<any> = function () {
6+
return (
7+
<div className="dtc-not-found">
8+
<h1>
9+
<FrownOutlined /> 亲,是不是走错地方了?
10+
</h1>
11+
</div>
12+
);
13+
};
414

5-
export default class NotFound extends React.Component<any, any> {
6-
render() {
7-
return (
8-
<div style={{ lineHeight: '200px', textAlign: 'center' }}>
9-
<h1>
10-
<FrownOutlined /> 亲,是不是走错地方了?
11-
</h1>
12-
</div>
13-
);
14-
}
15-
}
15+
export default NotFound;

src/notFound/style.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.dtc-not-found {
2+
line-height: 200px;
3+
text-align: center;
4+
}

0 commit comments

Comments
 (0)