Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored React OpenWebIcons with Typescript #1

Merged
merged 2 commits into from
Apr 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2017 Marvin Dalheimer

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.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,28 @@ npm install --save react-openwebicons
## Usage

```JavaScript
//index.jsx
import React from 'react';
import ReactDOM from 'react-dom';
import OpenWebIcon from 'react-openwebicons';

ReactDOM.render(
<OpenWebIcon name="openid" />,
document.body.appendChild(document.createElement('div'))
);
ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px" colored={true}/>, document.getElementById("app"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px" colored="#990000"/>, document.getElementById("app2"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px"/>, document.getElementById("app3"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub"/>, document.getElementById("app4"));
```

For more informations have a look at the example folder.

## How to develop

- npm/yarn install
- npm run build
- npm link
- cd example
- npm/yarn install
- npm link "react-openwebicons"
- webpack
- open index.html in web browser

To change the icon, size or color adjust the values in the index.tsx in the example folder and run webpack again
40 changes: 40 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Created by .ignore support plugin (hsz.mobi)
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pids
*.pid
*.seed
*.pid.lock
lib-cov
coverage
.nyc_output
.grunt
bower_components
.lock-wscript
build/Release
node_modules/
jspm_packages/
typings/
.npm
.eslintcache
.node_repl_history
*.tgz
.yarn-integrity
.env
.idea/
*.iws
/out/
.idea_modules/
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

*.js
*.map

!webpack.config.js
10 changes: 10 additions & 0 deletions example/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@font-face {
font-family: 'OpenWeb Icons';
src: url('node_modules/openwebicons/font/openwebicons.eot');
src: url('node_modules/openwebicons/font/openwebicons.eot?#iefix') format('embedded-opentype'),
url('node_modules/openwebicons/font/openwebicons.woff') format('woff'),
url('node_modules/openwebicons/font/openwebicons.ttf') format('truetype'),
url('node_modules/openwebicons/font/openwebicons.svg#OpenWebIconsRegular') format('svg');
font-weight: normal;
font-style: normal;
}
15 changes: 15 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/openwebicons/1.4.2/css/openwebicons.min.css"/>
</head>
<body>
<div id="app"></div>
<div id="app2"></div>
<div id="app3"></div>
<div id="app4"></div>
<script src="index.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions example/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import OpenWebIcon from "react-openwebicons";

ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px" colored={true}/>, document.getElementById("app"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px" colored="#990000"/>, document.getElementById("app2"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub" size="248px"/>, document.getElementById("app3"));
ReactDOM.render(<OpenWebIcon name="openwebicons-epub"/>, document.getElementById("app4"));
18 changes: 18 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "TestIcons",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2",
"openwebicons": "^1.4.2"
},
"devDependencies": {
"@types/react": "^15.0.10",
"@types/react-dom": "^0.14.23",
"ts-loader": "^2.0.0",
"typescript": "^2.1.6",
"webpack": "^2.2.1"
}
}
17 changes: 17 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"jsx": "react",
"outDir": ".",
"allowJs": true
},
"exclude": [
"node_modules"
],
"files": [
"node_modules/react-openwebicons/lib/@types/react-openwebicons.d.ts",
"index.tsx"
]
}
19 changes: 19 additions & 0 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
entry: "./index.tsx",
output: {
path: "./",
filename: "index.js"
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: "node_modules/"
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".jsx", ".js"]
}
};
Loading