├── .eslintignore ├── .github └── demo.gif ├── .babelrc ├── .storybook ├── addons.js ├── config.js └── webpack.config.js ├── .gitignore ├── .editorconfig ├── stories ├── style.css ├── index.stories.js └── picker-wrappers │ ├── OnePicker.vue │ └── TwoPickers.vue ├── rollup.config.js ├── .eslintrc.yaml ├── LICENSE ├── package.json ├── README.md └── src └── FontPicker.vue /.eslintignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | -------------------------------------------------------------------------------- /.github/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rodrigobendia/font-picker-vue/HEAD/.github/demo.gif -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false 5 | }], 6 | "vue" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '@storybook/addon-actions/register'; 2 | import '@storybook/addon-links/register'; 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS 2 | .DS_Store 3 | Thumbs.db 4 | 5 | # WebStorm (IDE) 6 | .idea/ 7 | 8 | # Node 9 | node_modules/ 10 | 11 | # build output 12 | lib/ -------------------------------------------------------------------------------- /.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { configure } from '@storybook/vue'; 2 | 3 | function loadStories() { 4 | require('../stories/index.stories') 5 | } 6 | 7 | configure(loadStories, module); 8 | -------------------------------------------------------------------------------- /.storybook/webpack.config.js: -------------------------------------------------------------------------------- 1 | const VueLoaderPlugin = require('vue-loader/lib/plugin') 2 | 3 | module.exports = (baseConfig, env, defaultConfig) => { 4 | 5 | defaultConfig.plugins.push(new VueLoaderPlugin()) 6 | 7 | return defaultConfig; 8 | }; 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = tab 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.{md,yaml,yml}] 12 | indent_style = space 13 | -------------------------------------------------------------------------------- /stories/style.css: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | display: flex; 3 | align-items: center; 4 | padding: 100px; 5 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 6 | } 7 | 8 | [class^="apply-font"] { 9 | margin-left: 50px; 10 | } 11 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import VuePlugin from 'rollup-plugin-vue'; 2 | import VueLoaderPlugin from 'vue-loader'; 3 | 4 | export default { 5 | input: 'src/FontPicker.vue', 6 | output: { 7 | file: 'lib/FontPicker.js', 8 | format: 'cjs' 9 | }, 10 | external: ['vue', 'font-picker'], 11 | plugins: [VuePlugin(/* VuePluginOptions */), VueLoaderPlugin] 12 | }; 13 | -------------------------------------------------------------------------------- /.eslintrc.yaml: -------------------------------------------------------------------------------- 1 | extends: airbnb 2 | 3 | env: 4 | browser: true 5 | node: true 6 | 7 | rules: 8 | # Default rules 9 | comma-dangle: 10 | - 2 11 | - never 12 | indent: 13 | - 2 14 | - tab 15 | no-tabs: 0 16 | object-curly-newline: 0 17 | object-curly-spacing: 18 | - 2 19 | - always 20 | - objectsInObjects: false 21 | 22 | # Project-specific rules 23 | no-console: 0 24 | import/no-extraneous-dependencies: 25 | - 2 26 | - devDependencies: true # ignore storybook-react 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Samuel Meuli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /stories/index.stories.js: -------------------------------------------------------------------------------- 1 | import { storiesOf } from '@storybook/vue'; 2 | import OnePicker from './picker-wrappers/OnePicker.vue'; 3 | import TwoPickers from './picker-wrappers/TwoPickers.vue'; 4 | 5 | import './style.css'; 6 | 7 | storiesOf('FontPicker', module) 8 | .add('GitHub demo', () => ({ 9 | components: { OnePicker }, 10 | template: '' 11 | })) 12 | .add('Local default font', () => ({ 13 | components: { OnePicker }, 14 | template: '' 15 | })) 16 | .add('Non-existent default font', () => ({ 17 | components: { OnePicker }, 18 | template: '' 19 | })) 20 | .add('Custom font variants', () => ({ 21 | components: { OnePicker }, 22 | template: '' 23 | })) 24 | .add('Two font pickers', () => ({ 25 | components: { TwoPickers }, 26 | template: '' 27 | })); 28 | -------------------------------------------------------------------------------- /stories/picker-wrappers/OnePicker.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 47 | -------------------------------------------------------------------------------- /stories/picker-wrappers/TwoPickers.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "font-picker-vue", 3 | "version": "1.0.3", 4 | "description": "Font selector component for Google Fonts", 5 | "keywords": [ 6 | "fonts", 7 | "google fonts", 8 | "selector", 9 | "picker", 10 | "component", 11 | "preview", 12 | "download", 13 | "vue", 14 | "vue-component" 15 | ], 16 | "main": "lib/FontPicker.js", 17 | "author": "Rodrigo Bendia ", 18 | "repository": "github:rodrigobendia/font-picker-vue", 19 | "homepage": "https://samuelmeuli.github.io/font-picker", 20 | "license": "MIT", 21 | "scripts": { 22 | "start": "npm-run-all build --parallel start:*", 23 | "start:rollup": "rollup --config --sourcemap --watch", 24 | "start:storybook": "start-storybook --port 3001", 25 | "build": "rollup --config", 26 | "lint": "eslint .", 27 | "precommit": "npm run lint", 28 | "prepush": "npm run lint" 29 | }, 30 | "dependencies": { 31 | "font-picker": "^2.0.6" 32 | }, 33 | "peerDependencies": { 34 | "vue": "^2.0.0" 35 | }, 36 | "devDependencies": { 37 | "@storybook/addon-actions": "^3.4.11", 38 | "@storybook/addon-links": "^3.4.11", 39 | "@storybook/addons": "^3.4.11", 40 | "@storybook/vue": "^3.4.11", 41 | "babel-core": "^6.26.3", 42 | "babel-plugin-external-helpers": "^6.22.0", 43 | "babel-preset-env": "^1.7.0", 44 | "babel-preset-vue": "^2.0.2", 45 | "eslint": "^4.19.1", 46 | "eslint-config-airbnb": "^16.1.0", 47 | "eslint-plugin-import": "^2.14.0", 48 | "eslint-plugin-jsx-a11y": "^6.1.2", 49 | "eslint-plugin-react": "^7.11.1", 50 | "eslint-plugin-vue": "^4.7.1", 51 | "husky": "^0.14.3", 52 | "node-sass": "^4.9.3", 53 | "npm-run-all": "^4.1.3", 54 | "rollup": "^0.64.1", 55 | "rollup-plugin-babel": "^3.0.7", 56 | "rollup-plugin-vue": "^4.3.2", 57 | "vue": "^2.0.0", 58 | "vue-loader": "^15.4.2", 59 | "vue-template-compiler": "^2.5.17" 60 | }, 61 | "files": [ 62 | "lib/" 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Font Picker for Vue 2 | 3 | **A simple, customizable font picker allowing users to preview, select, and use Google Fonts on your website.** 4 | 5 | * Automatic font download and generation of the required CSS styles 6 | * Efficient font previews (previews are loaded dynamically and full fonts are only downloaded on selection) 7 | 8 | → **[Demo](https://samuelmeuli.github.io/font-picker)** 9 | 10 | _This is the Vue component for the [**Font Picker**](https://github.com/samuelmeuli/font-picker) package._ 11 | 12 |

13 | Demo 14 |

15 | 16 | 17 | ## Getting started 18 | 19 | ### 1. Setup 20 | 21 | Install the package using **NPM**: 22 | 23 | ```sh 24 | npm install font-picker-vue 25 | ``` 26 | 27 | 28 | ### 2. Displaying the font picker 29 | 30 | Import the **`` component** to your Vue code: 31 | 32 | ```javascript 33 | 34 | import Vue from 'vue'; 35 | import FontPicker from 'font-picker-vue'; 36 | 37 | Vue.use(FontPicker); 38 | ``` 39 | 40 | Use the component: 41 | 42 | ```html 43 | 2 |
3 | 10 |
    13 |
  • 14 | 18 |
  • 19 |
20 |
21 | 22 | 23 | 190 | 191 | 330 | --------------------------------------------------------------------------------