mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 08:57:26 +08:00
added an optional (react) style property to the react-fontawesome definition file. (#18807)
* added a React style property to the react-fontawesome definition file. * made amendments to FontAwesomeProps as suggest by vincaslt, now successfully extend React.HTMLProps<FontAwesome>.
This commit is contained in:
committed by
Mohamed Hegazy
parent
5beea6b1a9
commit
21a7a8a0b7
12
types/react-fontawesome/index.d.ts
vendored
12
types/react-fontawesome/index.d.ts
vendored
@@ -1,8 +1,9 @@
|
||||
// Type definitions for react-fontawesome 1.6
|
||||
// Project: https://github.com/danawoodman/react-fontawesome
|
||||
// Definitions by: Timur Rustamov <https://github.com/timurrustamov>,
|
||||
// Definitions by: Timur Rustamov <https://github.com/timurrustamov>
|
||||
// Anton Kandybo <https://github.com/dublicator>
|
||||
// Vincas Stonys <https://github.com/vincaslt>
|
||||
// Gavin Gregory <https://github.com/gavingregory>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -12,13 +13,12 @@ export = FontAwesome;
|
||||
|
||||
declare namespace FontAwesome {
|
||||
type FontAwesomeSize = 'lg' | '2x' | '3x' | '4x' | '5x';
|
||||
type FontAwesomeStack = "1x" | "2x";
|
||||
type FontAwesomeFlip = "horizontal" | "vertical";
|
||||
type FontAwesomeStack = '1x' | '2x';
|
||||
type FontAwesomeFlip = 'horizontal' | 'vertical';
|
||||
|
||||
interface FontAwesomeProps {
|
||||
type FontAwesomeProps = React.HTMLProps<FontAwesome> | {
|
||||
ariaLabel?: string;
|
||||
border?: boolean;
|
||||
className?: string;
|
||||
cssModule?: any;
|
||||
fixedWidth?: boolean;
|
||||
flip?: FontAwesomeFlip;
|
||||
@@ -30,7 +30,7 @@ declare namespace FontAwesome {
|
||||
spin?: boolean;
|
||||
stack?: FontAwesomeStack;
|
||||
tag?: string;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
declare class FontAwesome extends React.Component<FontAwesome.FontAwesomeProps> {}
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import FontAwesome = require('react-fontawesome');
|
||||
|
||||
class TestComponent extends React.Component {
|
||||
class BasicTestComponent extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<FontAwesome
|
||||
@@ -14,3 +14,14 @@ class TestComponent extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CSSTestComponent extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<FontAwesome
|
||||
name="rocket"
|
||||
style={{backgroundColor: 'red', color: 'blue'}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user