Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-google-font-loader

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-google-font-loader - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

package-lock.json

3

build/index.d.ts

@@ -5,3 +5,3 @@ import * as React from 'react';

font: string;
weights?: number[];
weights?: (string|number)[];
}

@@ -11,2 +11,3 @@

fonts: Font[];
subsets?: string[];
}

@@ -13,0 +14,0 @@

@@ -40,3 +40,5 @@ 'use strict';

return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = GoogleFontLoader.__proto__ || Object.getPrototypeOf(GoogleFontLoader)).call.apply(_ref, [this].concat(args))), _this), _this.link = null, _this.createLink = function () {
var fonts = _this.props.fonts;
var _this$props = _this.props,
fonts = _this$props.fonts,
subsets = _this$props.subsets;

@@ -57,2 +59,6 @@

if (subsets && Array.isArray(subsets) && subsets.length > 0) {
link.href += '&subset=' + subsets.join(',');
}
return link;

@@ -98,6 +104,7 @@ }, _this.appendLink = function () {

font: _propTypes2.default.string.isRequired,
weights: _propTypes2.default.arrayOf(_propTypes2.default.number)
})).isRequired
weights: _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]))
})).isRequired,
subsets: _propTypes2.default.arrayOf(_propTypes2.default.string)
};
exports.default = GoogleFontLoader;
{
"name": "react-google-font-loader",
"version": "1.0.4",
"version": "1.0.5",
"description": "Simple React component to load Google Fonts.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -25,12 +25,15 @@ # GoogleFontLoader [![npm](https://img.shields.io/npm/v/react-google-font-loader.svg?style=for-the-badge)](https://www.npmjs.com/package/react-google-font-loader)

{/* Use it! */}
<GoogleFontLoader fonts={[
{
font: 'Roboto',
weights: [400],
},
{
font: 'Roboto Mono',
weights: [400, 700],
},
]} />
<GoogleFontLoader
fonts={[
{
font: 'Roboto',
weights: [400, '400i'],
},
{
font: 'Roboto Mono',
weights: [400, 700],
},
]}
subsets={['cyrillic-ext', 'greek']}
/>

@@ -45,4 +48,7 @@ <p style={{ fontFamily: 'Roboto Mono, monospaced' }}>This will be in Roboto Mono!</p>

The Component takes one prop: `fonts`. It should be an array of objects describing the fonts you want to load.
The Component takes two props: `fonts` and `subsets`.
#### `fonts`
`fonts` should be an array of objects describing the fonts you want to load:
```JavaScript

@@ -52,3 +58,3 @@ [

font: 'Roboto Mono', // The name of the font on Google Fonts.
weights: [400, 700], // An array of weights you want to load.
weights: [400, 700], // An array of weights you want to load, can be strings or numbers.
},

@@ -59,1 +65,8 @@ // ...

```
#### `subsets`
`subsets` should be an array of subsets you want to load. **This prop is optional** - if you do not specify a `subsets` prop then the 'subset' query param will be omitted from the URL and only latin will be loaded.
```JavaScript
['cyrillic-ext', 'greek']
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc