Skip to content

Commit f23aa58

Browse files
committed
update the way to load css
rm useless webpack loader update readme & add issue template
1 parent 6db61e9 commit f23aa58

File tree

9 files changed

+138
-64
lines changed

9 files changed

+138
-64
lines changed

.github/CONTRIBUTING_en-us.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# react-amap Contributing Guide
2+
3+
Hi! Thank you for choosing react-amap.
4+
5+
React-amap is a Map Components Based On React and AMap(amap.com)
6+
7+
We are excited that you are interested in contributing to react-amap. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
8+
9+
## Issue Guidelines
10+
- Issues are exclusively for bug reports and feature requests. Other questions may be closed directly.
11+
12+
- Before submitting an issue, please check if similar problems have already been issued.
13+
14+
- Please specify which version of react-amap you are using, and provide OS and browser information. [JSFiddle](https://jsfiddle.net/) is recommended to build a live demo so that your issue can be reproduced clearly.
15+
16+
## Pull Request Guidelines
17+
- Fork this repository to your own account. Do not create branches here.
18+
19+
- **DO NOT** include files inside `lib` directory.
20+
21+
- Rebase before creating a PR to keep commit history clear.
22+
23+
- If you are fixing a bug, please include detailed description of the bug in the PR.
24+
25+
- Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.
26+
27+
## Code Style
28+
Just comply with the [ESLint](https://github.com/ElemeFE/eslint-config-elemefe) configuration of [ElemeFE](https://github.com/elemefe).

.github/CONTRIBUTING_zh-cn.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# react-amap Contributing Guide
2+
3+
Hi! 首先感谢你使用 react-amap。
4+
5+
react-amap 是一个基于 React 封装的高德地图组件库。
6+
7+
react-amap 的成长离不开大家的支持,如果你愿意为 react-amap 贡献代码或提供建议,请阅读以下内容。
8+
9+
## Issue 规范
10+
- issue 仅用于提交 Bug 或 Feature,其它内容可能会被直接关闭。
11+
12+
- 在提交 issue 之前,请搜索相关内容是否已被提出。
13+
14+
- 请说明 react-amap 的版本号,并提供操作系统和浏览器信息。推荐使用 [JSFiddle](https://jsfiddle.net/) 生成在线 demo,这能够更直观地重现问题。
15+
16+
## Pull Request 规范
17+
- 请先 fork 一份到自己的项目下,不要直接在仓库下建分支。
18+
19+
- **不要提交** `lib` 里面打包的文件。
20+
21+
- 提交 PR 前请 rebase,确保 commit 记录的整洁。
22+
23+
- 如果是修复 bug,请在 PR 中给出描述信息。
24+
25+
- 合并代码需要两名维护人员参与:一人进行 review 后 approve,另一人再次 review,通过后即可合并。
26+
27+
## 代码规范
28+
遵循饿了么前端的 [ESLint](https://github.com/ElemeFE/eslint-config-elemefe) 即可

.github/ISSUE_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
Thank you for contributing! Please carefully read the following before opening your issue.
3+
-->
4+
5+
### react-amap version
6+
<!-- 1.0.0 -->
7+
8+
### OS/Browers version
9+
<!-- macOS/Chrome 53 -->
10+
11+
### Reproduction Link
12+
<!-- A minimal JSBin, JSFiddle, Codepen, or a GitHub repository that can reproduce the bug. -->
13+
14+
### Steps to reproduce
15+
16+
### What is Expected?
17+
18+
### What is actually happening?

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Please makes sure these boxes are checked before submitting your PR, thank you!
2+
3+
* [ ] Make sure you follow the contributing guide.
4+
* [ ] Rebase before creating a PR to keep commit history clear.
5+
* [ ] Add some descriptions and refer relative issues for you PR.

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ tips: 记得将其中的 `VERSION` 替换为真实版本号,查看历史版本
7777
+ https://unpkg.com/react-amap@VERSION/dist/react-amap.js
7878
+ https://unpkg.com/react-amap@VERSION/dist/react-amap.min.js
7979

80-
当前最新版本 `0.2.6`
81-
82-
+ https://unpkg.com/react-amap@0.2.6/dist/react-amap.js
83-
+ https://unpkg.com/react-amap@0.2.6/dist/react-amap.min.js
84-
8580
### 关于 Key
8681

8782
在上面的例子中需要给 Map 组件传入 `amapkey` 属性,这个是高德地图给开发者分配的开发者 Key;你可以在[高德开放平台](http://lbs.amap.com/faq/account/key/67)申请你自己的 Key。

components/_assets/marker.css

Lines changed: 0 additions & 53 deletions
This file was deleted.

components/markers/index.js

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,64 @@ import {
1111
} from '../_utils/markerUtils';
1212

1313
if (typeof window !== 'undefined') {
14-
require('../_assets/marker.css');
14+
const styleText = `.amap_markers_pop_window{
15+
padding: 10px;
16+
border: 1px solid #ddd;
17+
border-radius: 8px;
18+
background: #fff;
19+
position: relative;
20+
display: flex;
21+
flex-wrap: wrap;
22+
justify-content: flex-start;
23+
}
24+
.amap_markers_pop_window::before{
25+
content: ' ';
26+
display: block;
27+
position: absolute;
28+
bottom: -12px;
29+
left: 50%;
30+
margin-left: -7px;
31+
width: 0;
32+
height: 0;
33+
border-top: 12px solid #ddd;
34+
border-left: 7px solid transparent;
35+
border-right: 7px solid transparent;
36+
}
37+
.amap_markers_pop_window::after{
38+
content: ' ';
39+
display: block;
40+
position: absolute;
41+
bottom: -11px;
42+
left: 50%;
43+
margin-left: -6px;
44+
width: 0;
45+
height: 0;
46+
border-top: 11px solid #fff;
47+
border-left: 6px solid transparent;
48+
border-right: 6px solid transparent;
49+
}
50+
.amap_markers_pop_window_item{
51+
cursor:pointer;
52+
width: 40px;
53+
height: 50px;
54+
display: flex;
55+
align-items: flex-end;
56+
justify-content: center;
57+
}
58+
.amap_markers_pop_window_item span{
59+
pointer-events: none;
60+
}
61+
.amap_markers_window_overflow_warning{
62+
text-align: center;
63+
width: 100%;
64+
margin: 5px 0;
65+
color: #666;
66+
}`;
67+
const headEl = document.head || document.getElementsByTagName('head')[0];
68+
const styleEl = document.createElement('style');
69+
styleEl.type = 'text/css';
70+
styleEl.textContent = styleText;
71+
headEl.appendChild(styleEl);
1572
}
1673

1774
const Component = React.Component;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"lint": "eslint . --quiet",
88
"browser-build": "webpack && NODE_ENV=production webpack",
9-
"npm-build": "babel components -d lib && cp -R components/_assets lib/",
9+
"npm-build": "rm -rf lib && babel components -d lib && cp -R components/_assets lib/",
1010
"site": "npm run npm-build && bisheng build",
1111
"deploy": "npm run npm-build && bisheng gh-pages",
1212
"start": "npm run npm-build && bisheng start",

webpack.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ var webpackConfig = {
1818
query: {
1919
presets: ['es2015', 'stage-0', 'react']
2020
}
21-
},
22-
{
23-
test: /\.css$/,
24-
loader: ['style-loader', 'css-loader']
2521
}
2622
]
2723
},

0 commit comments

Comments
 (0)