feedback fixes

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2022-03-25 10:06:37 +01:00
parent 1f84e612e3
commit 07c0610557
12 changed files with 792 additions and 3530 deletions
+1 -3
View File
@@ -1,3 +1 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
+2 -2
View File
@@ -29,8 +29,8 @@ When you have your `packages/app/src/components/search/SearchPage.tsx` file read
case 'stack-overflow':
return (
<StackOverflowSearchResultListItem
key={result.document.location}
result={result.document}
key={document.location}
result={document}
/>
);
```
+28
View File
@@ -0,0 +1,28 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Config {
/**
* Configuration options for the stack overflow plugin
*/
stackoverflow: {
/**
* The base url of the Stack Overflow API used for the plugin
* @visibility frontend
*/
baseUrl: string;
};
}
+20 -17
View File
@@ -9,6 +9,9 @@
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin"
},
"scripts": {
"build": "backstage-cli package start",
"start": "backstage-cli package build",
@@ -20,16 +23,16 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/core-components": "^0.8.8",
"@backstage/plugin-home": "^0.4.15",
"@backstage/core-plugin-api": "^0.6.0",
"@backstage/search-common": "^0.2.2",
"@backstage/config": "^0.1.13",
"@backstage/theme": "^0.2.14",
"@backstage/core-components": "^0.9.3-next.0",
"@backstage/plugin-home": "^0.4.20-next.0",
"@backstage/core-plugin-api": "^1.0.0",
"@backstage/plugin-search-common": "^0.3.3-next.0",
"@backstage/config": "^1.0.0",
"@backstage/theme": "^0.2.15",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"qs": "^6.10.3",
"cross-fetch": "^3.0.6",
"qs": "^6.9.4",
"cross-fetch": "^3.1.5",
"lodash": "^4.17.21",
"react-use": "^17.2.4",
"@testing-library/jest-dom": "^5.10.1"
@@ -39,18 +42,18 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.15.2",
"@backstage/test-utils": "^0.3.0",
"@backstage/cli": "^0.16.1-next.0",
"@backstage/test-utils": "^1.0.1-next.0",
"@testing-library/react": "^12.1.3",
"@backstage/core-app-api": "^0.5.2",
"@backstage/dev-utils": "^0.2.21-next.0",
"@backstage/core-app-api": "^1.0.1-next.0",
"@backstage/dev-utils": "^1.0.1-next.0",
"@testing-library/user-event": "^13.1.8",
"@types/jest": "*",
"@types/node": "*",
"msw": "^0.35.0",
"cross-fetch": "^3.0.6"
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32",
"msw": "^0.35.0"
},
"files": [
"dist"
"dist",
"config"
]
}
@@ -41,12 +41,14 @@ import {
export const Content = (props: StackOverflowQuestionsContentProps) => {
const { requestParams } = props;
const configApi = useApi(configApiRef);
const baseUrl = configApi.getOptionalString('stackoverflow.baseUrl');
const baseUrl =
configApi.getOptionalString('stackoverflow.baseUrl') ||
'https://api.stackexchange.com/2.2';
const { value, loading, error } = useAsync(async (): Promise<
StackOverflowQuestion[]
> => {
const params = requestParams ? `?${qs.stringify(requestParams)}` : '';
const params = qs.stringify(requestParams, { addQueryPrefix: true });
const response = await fetch(`${baseUrl}/questions${params}`);
const data = await response.json();
return data.items;