Skip to content

Commit 487a60f

Browse files
committed
Move package under /package folder + React/Svelte/Vue components
1 parent 42cbec5 commit 487a60f

File tree

1,426 files changed

+4355
-1122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,426 files changed

+4355
-1122
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
.DS_Store
12
.git
23
npm-debug.log
34
node_modules
5+
package/react/*.js
6+
package/react/esm/*.js
7+
package/react/cjs/*.js
8+
package/vue/*.js
9+
package/vue/vue/*.vue
10+
package/svelte/*.js
11+
package/svelte/svelte/*.svelte

.npmignore

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

.prettierrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"htmlWhitespaceSensitivity": "css",
5+
"insertPragma": false,
6+
"jsxBracketSameLine": false,
7+
"jsxSingleQuote": false,
8+
"printWidth": 100,
9+
"proseWrap": "preserve",
10+
"quoteProps": "as-needed",
11+
"requirePragma": false,
12+
"semi": true,
13+
"singleQuote": true,
14+
"tabWidth": 2,
15+
"trailingComma": "all",
16+
"useTabs": false,
17+
"vueIndentScriptAndStyle": false
18+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
}

README.md

Lines changed: 131 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,51 @@ The font is developed to be used with [Framework7](http://framework7.io/), but y
1111
1. Download and extract the font pack
1212
2. Copy the `framework7-icons.css` to your project or add this CSS to your own CSS file:
1313

14-
```css
15-
@font-face {
16-
font-family: 'Framework7 Icons';
17-
font-style: normal;
18-
font-weight: 400;
19-
src: url("../fonts/Framework7Icons-Regular.eot");
20-
src: local('Framework7 Icons'),
21-
local('Framework7Icons-Regular'),
22-
url("../fonts/Framework7Icons-Regular.woff2") format("woff2"),
23-
url("../fonts/Framework7Icons-Regular.woff") format("woff"),
24-
url("../fonts/Framework7Icons-Regular.ttf") format("truetype");
25-
}
26-
27-
.f7-icons, .framework7-icons {
28-
font-family: 'Framework7 Icons';
29-
font-weight: normal;
30-
font-style: normal;
31-
font-size: 28px;
32-
line-height: 1;
33-
letter-spacing: normal;
34-
text-transform: none;
35-
display: inline-block;
36-
white-space: nowrap;
37-
word-wrap: normal;
38-
direction: ltr;
39-
-webkit-font-smoothing: antialiased;
40-
text-rendering: optimizeLegibility;
41-
-moz-osx-font-smoothing: grayscale;
42-
-webkit-font-feature-settings: "liga";
43-
-moz-font-feature-settings: "liga=1";
44-
-moz-font-feature-settings: "liga";
45-
font-feature-settings: "liga";
46-
}
47-
```
14+
```css
15+
@font-face {
16+
font-family: 'Framework7 Icons';
17+
font-style: normal;
18+
font-weight: 400;
19+
src: url('../fonts/Framework7Icons-Regular.eot');
20+
src: local('Framework7 Icons'), local('Framework7Icons-Regular'),
21+
url('../fonts/Framework7Icons-Regular.woff2') format('woff2'), url('../fonts/Framework7Icons-Regular.woff')
22+
format('woff'), url('../fonts/Framework7Icons-Regular.ttf') format('truetype');
23+
}
24+
25+
.f7-icons,
26+
.framework7-icons {
27+
font-family: 'Framework7 Icons';
28+
font-weight: normal;
29+
font-style: normal;
30+
font-size: 28px;
31+
line-height: 1;
32+
letter-spacing: normal;
33+
text-transform: none;
34+
display: inline-block;
35+
white-space: nowrap;
36+
word-wrap: normal;
37+
direction: ltr;
38+
-webkit-font-smoothing: antialiased;
39+
text-rendering: optimizeLegibility;
40+
-moz-osx-font-smoothing: grayscale;
41+
-webkit-font-feature-settings: 'liga';
42+
-moz-font-feature-settings: 'liga=1';
43+
-moz-font-feature-settings: 'liga';
44+
font-feature-settings: 'liga';
45+
}
46+
```
47+
4848
3. Copy the `fonts` folder to your project
4949
4. Ensure the font urls within `framework7-icons.css` properly reference the `fonts` path within your project.
5050
5. Include a reference to the `framework7-icons.css` file from every webpage you need to use it:
5151

52-
```html
53-
<link rel="stylesheet" href="path/to/framework7-icons.css">
54-
```
52+
```html
53+
<link rel="stylesheet" href="path/to/framework7-icons.css" />
54+
```
5555

5656
Or with [component](https://github.com/componentjs/component):
5757

58-
$ component install nolimits4web/framework7-icons
58+
$ component install framework7io/framework7-icons
5959

6060
Or with [bower](http://bower.io/):
6161

@@ -80,10 +80,10 @@ Then you can import the module like so:
8080
import 'framework7-icons';
8181
```
8282

83-
8483
## HTML Example
8584

8685
You can use [framework7.io](http://framework7.io) or included `cheatsheet.html` file to easily find the icon you want to use. It’s easy to incorporate icons into your web page. Here’s a small example:
86+
8787
```html
8888
<i class="f7-icons">house</i>
8989
```
@@ -97,10 +97,18 @@ This example uses a typographic feature called [ligatures](http://alistapart.com
9797
Framework7 Icons look best at 28px, but if an icon needs to be displayed in an alternative size, just use CSS `font-size` rule:
9898

9999
```css
100-
.size-14 { font-size: 14px }
101-
.size-28 { font-size: 28px }
102-
.size-32 { font-size: 32px }
103-
.size-56 { font-size: 56px }
100+
.size-14 {
101+
font-size: 14px;
102+
}
103+
.size-28 {
104+
font-size: 28px;
105+
}
106+
.size-32 {
107+
font-size: 32px;
108+
}
109+
.size-56 {
110+
font-size: 56px;
111+
}
104112
```
105113

106114
```html
@@ -115,13 +123,16 @@ Framework7 Icons look best at 28px, but if an icon needs to be displayed in an a
115123
Using the icon font allows for easy styling of an icon in any color.
116124

117125
```css
118-
.color-black { color: #000 }
119-
.color-white { color: #fff }
126+
.color-black {
127+
color: #000;
128+
}
129+
.color-white {
130+
color: #fff;
131+
}
120132
```
121133

122134
```html
123-
<i class="f7-icons color-black">house</i>
124-
<i class="f7-icons color-white">house</i>
135+
<i class="f7-icons color-black">house</i> <i class="f7-icons color-white">house</i>
125136
```
126137

127138
## Using in `data-` attributes
@@ -130,8 +141,8 @@ Add the following CSS rule:
130141

131142
```css
132143
.f7-icons[data-icon]:before {
133-
content: attr(data-icon);
134-
color: inherit;
144+
content: attr(data-icon);
145+
color: inherit;
135146
}
136147
```
137148

@@ -141,26 +152,88 @@ And now you can use it with `data-` attributes:
141152
<i class="f7-icons" data-icon="house"></i>
142153
```
143154

155+
## SVG Components
156+
157+
Since v 4.0.0 there are pure SVG components available for React, Svelte and Vue.
158+
159+
In React:
160+
161+
```jsx
162+
import { House, HeartCircle } from 'framewokr7-icons/react';
163+
164+
export default () {
165+
// ...
166+
return (
167+
<div>
168+
<House />
169+
...
170+
<HeartCircle>
171+
</div>
172+
)
173+
}
174+
```
175+
176+
In Svelte:
177+
178+
```html
179+
<div>
180+
...
181+
<House />
182+
...
183+
<HeartCircle>
184+
...
185+
</div>
186+
<script>
187+
import { House, HeartCircle } from 'framewokr7-icons/svelte';
188+
// ...
189+
</script>
190+
```
191+
192+
In Vue:
193+
194+
```html
195+
<template>
196+
<div>
197+
...
198+
<f7-house />
199+
...
200+
<f7-heart-circle />
201+
...
202+
</div>
203+
</template>
204+
```
205+
206+
<script>
207+
import { House, HeartCircle } from 'framewokr7-icons/svelte';
208+
209+
export default {
210+
components: {
211+
f7House: House,
212+
f7HeartCircle: HeartCircle,
213+
},
214+
...
215+
}
216+
</script>
144217

145218
## Build Instructions
146219

147220
This repo already comes with all the files built and ready to go, but can also build the fonts from the source. Requires Python, FontForge and woff2:
148221

149-
1) Install FontForge, which is the program that creates the font files from the SVG files:
222+
1. Install FontForge, which is the program that creates the font files from the SVG files:
150223

151-
$ brew install fontforge ttfautohint
224+
$ brew install fontforge ttfautohint
152225

153-
2) Install woff2
226+
2. Install woff2
154227

155-
$ git clone --recursive https://github.com/google/woff2.git
156-
$ cd woff2
157-
$ make clean all
228+
$ git clone --recursive https://github.com/google/woff2.git
229+
$ cd woff2
230+
$ make clean all
158231

159-
3) Add or subtract files from the `src/` folder you'd like to be apart of the font files.
232+
3. Add or subtract files from the `src/` folder you'd like to be apart of the font files.
160233

161-
4) Run the build command:
234+
4. Run the build command:
162235

163-
python ./build/generate.py
236+
python ./build/generate.py
164237

165238
## License
166239

bower.json

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

build/babel-react.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
let modules = process.env.MODULES || false;
2+
if (modules === 'esm' || modules === 'false') modules = false;
3+
4+
module.exports = {
5+
presets: ['@babel/preset-react', ['@babel/preset-env', { modules, loose: true }]],
6+
};

build/build-font.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { promise: exec } = require('exec-sh');
2+
3+
const buildFont = async () => {
4+
exec(
5+
`python ./build/generate.py && ttf2woff ./package/fonts/Framework7Icons-Regular.ttf ./package/fonts/Framework7Icons-Regular.woff`,
6+
);
7+
};
8+
module.exports = buildFont;

0 commit comments

Comments
 (0)