MinJieLiu 7 年之前
当前提交
d413fb3e3b
共有 11 个文件被更改,包括 187 次插入0 次删除
  1. 20 0
      .editorconfig
  2. 27 0
      .gitignore
  3. 5 0
      .prettierrc
  4. 21 0
      LICENSE
  5. 3 0
      README.md
  6. 5 0
      examples/simple.css
  7. 14 0
      examples/simple.html
  8. 32 0
      examples/simple.tsx
  9. 51 0
      package.json
  10. 0 0
      src/index.tsx
  11. 9 0
      tsconfig.json

+ 20 - 0
.editorconfig

@@ -0,0 +1,20 @@
+# EditorConfig helps developers define and maintain consistent
+# coding styles between different editors and IDEs
+# http://editorconfig.org
+
+root = true
+
+[*]
+
+# Change these settings to your own preference
+indent_style = space
+indent_size = 2
+
+# We recommend you to keep these unchanged
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+trim_trailing_whitespace = true

+ 27 - 0
.gitignore

@@ -0,0 +1,27 @@
+*.iml
+*.log
+.idea/
+.ipr
+.iws
+*~
+~*
+*.diff
+*.patch
+*.bak
+.DS_Store
+Thumbs.db
+.project
+.*proj
+.svn/
+*.swp
+*.swo
+*.pyc
+*.pyo
+.build
+node_modules
+.cache
+dist
+assets/**/*.css
+build
+coverage
+yarn.lock

+ 5 - 0
.prettierrc

@@ -0,0 +1,5 @@
+{
+  "singleQuote": true,
+  "printWidth": 100,
+  "trailingComma": "all"
+}

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 MinJie
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# react-photo-view
+
+### Usage

+ 5 - 0
examples/simple.css

@@ -0,0 +1,5 @@
+* {
+  margin: 0;
+  padding: 0;
+  box-sizing: border-box;
+}

+ 14 - 0
examples/simple.html

@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+  <meta charset="UTF-8">
+  <title>React 图片预览组件 - Example</title>
+  <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
+  <meta name="renderer" content="webkit" />
+  <link href="./simple.css" type="text/css" rel="stylesheet" />
+</head>
+<body>
+<div id="root"></div>
+<script src="simple.tsx"></script>
+</body>
+</html>

+ 32 - 0
examples/simple.tsx

@@ -0,0 +1,32 @@
+import 'babel-polyfill';
+import React from 'react';
+import ReactDOM from 'react-dom';
+import styled from 'styled-components';
+
+const Container = styled.div`
+  padding: 0.4rem 0;
+  font-size: 0.32rem;
+`;
+
+const Header = styled.header`
+  padding: 0.2rem;
+  font-size: 0.35rem;
+  border-bottom: 1px solid #CCC;
+`;
+
+class Example extends React.Component {
+
+  render() {
+
+    return (
+      <Container>
+        <Header>React 图片预览组件</Header>
+      </Container>
+    );
+  }
+}
+
+ReactDOM.render(
+  <Example />,
+  document.getElementById('root'),
+);

+ 51 - 0
package.json

@@ -0,0 +1,51 @@
+{
+  "name": "react-photo-view",
+  "version": "0.0.1",
+  "description": "React photo preview",
+  "keywords": [
+    "react",
+    "react-component",
+    "react-photo-view",
+    "photo"
+  ],
+  "scripts": {
+    "watch-tsc": "rc-tools run watch-tsc",
+    "dist": "rc-tools run dist",
+    "build": "rc-tools run build",
+    "gh-pages": "rc-tools run gh-pages",
+    "start": "rc-tools run server",
+    "compile": "rc-tools run compile --babel-runtime",
+    "pub": "rc-tools run pub --babel-runtime",
+    "lint": "rc-tools run lint",
+    "karma": "rc-test run karma",
+    "saucelabs": "rc-test run saucelabs",
+    "test": "rc-test run test",
+    "prepublish": "rc-tools run guard",
+    "chrome-test": "rc-test run chrome-test",
+    "coverage": "rc-test run coverage"
+  },
+  "config": {
+    "port": 8001
+  },
+  "files": [
+    "lib"
+  ],
+  "main": "./lib",
+  "module": "./es",
+  "author": "LMY",
+  "license": "MIT",
+  "devDependencies": {
+    "@types/react": "^16.4.6",
+    "@types/react-dom": "^16.0.6",
+    "babel-polyfill": "^6.23.0",
+    "prettier": "^1.13.7",
+    "rc-test": "^6.0.9",
+    "rc-tools": "^8.1.1",
+    "react": "^16.4.1",
+    "react-dom": "^16.4.1",
+    "styled-components": "^3.3.3"
+  },
+  "dependencies": {
+    "prop-types": "^15.5.10"
+  }
+}

+ 0 - 0
src/index.tsx


+ 9 - 0
tsconfig.json

@@ -0,0 +1,9 @@
+{
+  "compilerOptions": {
+    "strictNullChecks": true,
+    "moduleResolution": "node",
+    "jsx": "preserve",
+    "allowSyntheticDefaultImports": true,
+    "target": "es6"
+  }
+}