diff options
author | 2022-05-14 08:50:02 -0500 | |
---|---|---|
committer | 2022-05-14 08:50:02 -0500 | |
commit | 8b1bfc356c3182c481394251f3ceeb902f2baec3 (patch) | |
tree | 5beeee82ccc2981cf989bb9e192bc3c1f53f1ae9 | |
parent | 6.0.0-nightly.34 [skip ci] (diff) | |
download | ferdium-app-8b1bfc356c3182c481394251f3ceeb902f2baec3.tar.gz ferdium-app-8b1bfc356c3182c481394251f3ceeb902f2baec3.tar.zst ferdium-app-8b1bfc356c3182c481394251f3ceeb902f2baec3.zip |
Typescript conversion
-rw-r--r-- | src/components/settings/recipes/RecipeItem.tsx (renamed from src/components/settings/recipes/RecipeItem.js) | 13 | ||||
-rw-r--r-- | src/models/RecipePreview.ts | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/components/settings/recipes/RecipeItem.js b/src/components/settings/recipes/RecipeItem.tsx index df5b42222..1dfe88683 100644 --- a/src/components/settings/recipes/RecipeItem.js +++ b/src/components/settings/recipes/RecipeItem.tsx | |||
@@ -1,15 +1,14 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
4 | 3 | ||
5 | import RecipePreviewModel from '../../../models/RecipePreview'; | 4 | import RecipePreviewModel from '../../../models/RecipePreview'; |
6 | 5 | ||
7 | class RecipeItem extends Component { | 6 | type Props = { |
8 | static propTypes = { | 7 | recipe: RecipePreviewModel; |
9 | recipe: PropTypes.instanceOf(RecipePreviewModel).isRequired, | 8 | onClick: () => {}; |
10 | onClick: PropTypes.func.isRequired, | 9 | }; |
11 | }; | ||
12 | 10 | ||
11 | class RecipeItem extends Component<Props> { | ||
13 | render() { | 12 | render() { |
14 | const { recipe, onClick } = this.props; | 13 | const { recipe, onClick } = this.props; |
15 | 14 | ||
@@ -18,7 +17,7 @@ class RecipeItem extends Component { | |||
18 | {recipe.isDevRecipe && ( | 17 | {recipe.isDevRecipe && ( |
19 | <span className="recipe-teaser__dev-badge">dev</span> | 18 | <span className="recipe-teaser__dev-badge">dev</span> |
20 | )} | 19 | )} |
21 | <img src={recipe.icons.svg} className="recipe-teaser__icon" alt="" /> | 20 | <img src={recipe.icon} className="recipe-teaser__icon" alt="" /> |
22 | <span className="recipe-teaser__label">{recipe.name}</span> | 21 | <span className="recipe-teaser__label">{recipe.name}</span> |
23 | {recipe.aliases && recipe.aliases.length > 0 && ( | 22 | {recipe.aliases && recipe.aliases.length > 0 && ( |
24 | <span className="recipe-teaser__alias_label"> | 23 | <span className="recipe-teaser__alias_label"> |
diff --git a/src/models/RecipePreview.ts b/src/models/RecipePreview.ts index fb8cb3e3e..53dd18f2c 100644 --- a/src/models/RecipePreview.ts +++ b/src/models/RecipePreview.ts | |||
@@ -4,6 +4,7 @@ interface IRecipePreview { | |||
4 | icon: string; | 4 | icon: string; |
5 | featured: boolean; | 5 | featured: boolean; |
6 | aliases: string[]; | 6 | aliases: string[]; |
7 | isDevRecipe: boolean; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | export default class RecipePreview { | 10 | export default class RecipePreview { |
@@ -17,6 +18,8 @@ export default class RecipePreview { | |||
17 | 18 | ||
18 | aliases: string[] = []; | 19 | aliases: string[] = []; |
19 | 20 | ||
21 | isDevRecipe: boolean = false; | ||
22 | |||
20 | constructor(data: IRecipePreview) { | 23 | constructor(data: IRecipePreview) { |
21 | if (!data) { | 24 | if (!data) { |
22 | throw new Error('RecipePreview config not valid'); | 25 | throw new Error('RecipePreview config not valid'); |