-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
activeFontFamily
and onChange
props optional
For consistency with the `font-picker` package.
- Loading branch information
1 parent
6d5374a
commit ebdbe7c
Showing
2 changed files
with
6 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,10 @@ type LoadingStatus = "loading" | "finished" | "error"; | |
interface Props { | ||
// Required props | ||
apiKey: string; | ||
activeFontFamily: string; | ||
onChange: (font: Font) => void; | ||
|
||
// Optional props | ||
activeFontFamily: string; | ||
onChange: (font: Font) => void; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
samuelmeuli
Author
Owner
|
||
pickerId: string; | ||
families: string[]; | ||
categories: Category[]; | ||
|
@@ -47,7 +47,8 @@ export default class FontPicker extends PureComponent<Props, State> { | |
fontManager: FontManager; | ||
|
||
static defaultProps = { | ||
defaultFamily: FONT_FAMILY_DEFAULT, | ||
activeFontFamily: FONT_FAMILY_DEFAULT, | ||
onChange: (): void => {}, // eslint-disable-line @typescript-eslint/no-empty-function | ||
pickerId: OPTIONS_DEFAULTS.pickerId, | ||
families: OPTIONS_DEFAULTS.families, | ||
categories: OPTIONS_DEFAULTS.categories, | ||
|
@@ -56,8 +57,6 @@ export default class FontPicker extends PureComponent<Props, State> { | |
filter: OPTIONS_DEFAULTS.filter, | ||
limit: OPTIONS_DEFAULTS.limit, | ||
sort: OPTIONS_DEFAULTS.sort, | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
onChange: (): void => {}, | ||
}; | ||
|
||
state: Readonly<State> = { | ||
|
This is not optional for TypeScript.
-> https://www.typescriptlang.org/docs/handbook/interfaces.html#optional-properties