aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/settings/recipes/RecipeItem.tsx
diff options
context:
space:
mode:
authorLibravatar muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com>2022-10-27 07:13:47 +0530
committerLibravatar GitHub <noreply@github.com>2022-10-27 01:43:47 +0000
commit81c43ecc3d17e0dbf7ad1d949b6d977f2c65bd48 (patch)
treedfa7c08cb54fb81b7d2e788d350de52c2ebd05d2 /src/components/settings/recipes/RecipeItem.tsx
parent6.2.1-nightly.30 [skip ci] (diff)
downloadferdium-app-81c43ecc3d17e0dbf7ad1d949b6d977f2c65bd48.tar.gz
ferdium-app-81c43ecc3d17e0dbf7ad1d949b6d977f2c65bd48.tar.zst
ferdium-app-81c43ecc3d17e0dbf7ad1d949b6d977f2c65bd48.zip
fix: 'failed prop' warning in QuickSwitchModal, SettingsNavigation, SettingsWindow and Recipe component tree (#713)
* chore: turn off eslint rule @typescript-eslint/no-useless-constructor to initialize dynamic props & state Co-authored-by: Muhamed <> Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/components/settings/recipes/RecipeItem.tsx')
-rw-r--r--src/components/settings/recipes/RecipeItem.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/components/settings/recipes/RecipeItem.tsx b/src/components/settings/recipes/RecipeItem.tsx
new file mode 100644
index 000000000..432e4e6a1
--- /dev/null
+++ b/src/components/settings/recipes/RecipeItem.tsx
@@ -0,0 +1,36 @@
1import { Component, MouseEventHandler } from 'react';
2import { observer } from 'mobx-react';
3import RecipePreview from '../../../models/RecipePreview';
4
5interface IProps {
6 recipe: RecipePreview;
7 onClick: MouseEventHandler<HTMLButtonElement>;
8}
9
10@observer
11class RecipeItem extends Component<IProps> {
12 constructor(props: IProps) {
13 super(props);
14 }
15
16 render() {
17 const { recipe, onClick } = this.props;
18
19 return (
20 <button type="button" className="recipe-teaser" onClick={onClick}>
21 {recipe.isDevRecipe && (
22 <span className="recipe-teaser__dev-badge">dev</span>
23 )}
24 <img src={recipe.icons?.svg} className="recipe-teaser__icon" alt="" />
25 <span className="recipe-teaser__label">{recipe.name}</span>
26 {recipe.aliases && recipe.aliases.length > 0 && (
27 <span className="recipe-teaser__alias_label">
28 {`Aliases: ${recipe.aliases.join(', ')}`}
29 </span>
30 )}
31 </button>
32 );
33 }
34}
35
36export default RecipeItem;