Skip to content

Commit

Permalink
feat: add new impl
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Nov 6, 2023
1 parent 7f338ba commit 96427b8
Show file tree
Hide file tree
Showing 64 changed files with 505 additions and 896 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ bower_components
coverage
npm-debug.log
yarn.lock
Gemfile.lock
yarn-error.log
package-lock.json
.DS_Store

# editor
.idea

# vscode
.vscode
.history
.idea

# python cache
__pycache__
dist
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.storybook
40 changes: 5 additions & 35 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
{
"trailingComma": "none",
"arrowParens": "always",
"printWidth": 80,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"semi": true,
"quoteProps": "consistent",
"singleQuote": true,
"overrides": [
{
"files": [
"*.json",
".eslintrc",
".tslintrc",
".prettierrc",
".tern-project"
],
"options": {
"parser": "json",
"tabWidth": 2
}
},
{
"files": "*.{css,sass,scss,less}",
"options": {
"parser": "postcss",
"tabWidth": 2
}
},
{
"files": "*.ts",
"options": {
"parser": "typescript"
}
}
]
"jsxBracketSameLine": true,
"trailingComma": "es5",
"quoteProps": "consistent"
}
14 changes: 0 additions & 14 deletions .release-it.json

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE.txt

This file was deleted.

123 changes: 2 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,2 @@
# react-page-exception
> React page exception component.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
npm install -S @jswork/react-page-exception
```

## properties
| Name | Type | Required | Default | Description |
| ----------- | ------ | -------- | --------------------------------------------------------------------- | ------------------------------------- |
| className | string | false | - | The extended className for component. |
| title | string | false | '404' | The title. |
| description | string | false | '抱歉,你访问的页面不存在' | The description. |
| image | string | false | 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg' | The exception icon. |


## usage
1. import css
```scss
@import "~@jswork/react-page-exception/dist/style.css";

// or use sass
@import "~@jswork/react-page-exception/dist/style.scss";

// customize your styles:
$react-page-exception-options: ()
```
2. import js
```js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactPageException from '@jswork/react-page-exception';
import './assets/style.scss';

class App extends React.Component {
state = {
value: '403',
items: [
{
title: '403',
description: '抱歉,你无权访问该页面',
image:
'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg'
},
{
title: '404',
description: '抱歉,你访问的页面不存在',
image:
'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg'
},
{
title: '500',
description: '抱歉,服务器出错了',
image:
'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg'
}
]
};

get value() {
const { items, value } = this.state;
return items.find((item) => item.title === value);
}

onChange = (inEvent) => {
const { value } = inEvent.target;
this.setState({ value });
};

render() {
const { items, value } = this.state;
return (
<ReactDemokit
className="p-3 app-container"
url="https://github.com/afeiship/react-page-exception">
<div className="select is-fullwidth is-rounded">
<select name="sel1" onChange={this.onChange}>
{items.map((item, index) => {
return (
<option key={index} value={item.title}>
{item.title}
</option>
);
})}
</select>
</div>
<ReactPageException {...this.value} />
</ReactDemokit>
);
}
}

ReactDOM.render(<App />, document.getElementById('app'));

```

## documentation
- https://afeiship.github.io/react-page-exception/


## license
Code released under [the MIT license](https://github.com/afeiship/react-page-exception/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/react-page-exception
[version-url]: https://npmjs.org/package/@jswork/react-page-exception

[license-image]: https://img.shields.io/npm/l/@jswork/react-page-exception
[license-url]: https://github.com/afeiship/react-page-exception/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-page-exception
[size-url]: https://github.com/afeiship/react-page-exception/blob/master/dist/react-page-exception.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/react-page-exception
[download-url]: https://www.npmjs.com/package/@jswork/react-page-exception
# react-component-library
> A react component library template.
12 changes: 0 additions & 12 deletions __tests__/index.spec.js

This file was deleted.

48 changes: 0 additions & 48 deletions bin/docs.rb

This file was deleted.

50 changes: 0 additions & 50 deletions build/TEMPLATE.md

This file was deleted.

29 changes: 0 additions & 29 deletions build/base.js

This file was deleted.

Loading

0 comments on commit 96427b8

Please sign in to comment.