Fix bug
This commit is contained in:
parent
7b202cdd64
commit
6932cdac8c
4 changed files with 71 additions and 70 deletions
|
@ -46,17 +46,17 @@ const AppDescription = styled.p`
|
||||||
export interface IAppProps {
|
export interface IAppProps {
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
url: string;
|
URL: string;
|
||||||
displayURL: string;
|
displayURL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const App = ({ name, icon, url, displayURL }: IAppProps) => (
|
export const App = ({ name, icon, URL, displayURL }: IAppProps) => (
|
||||||
<AppContainer>
|
<AppContainer>
|
||||||
<IconContainer>
|
<IconContainer>
|
||||||
<Icon name={icon} />
|
<Icon name={icon} />
|
||||||
</IconContainer>
|
</IconContainer>
|
||||||
<DetailsContainer>
|
<DetailsContainer>
|
||||||
<AppLink href={url}>{name}</AppLink>
|
<AppLink href={URL}>{name}</AppLink>
|
||||||
<AppDescription>{displayURL}</AppDescription>
|
<AppDescription>{displayURL}</AppDescription>
|
||||||
</DetailsContainer>
|
</DetailsContainer>
|
||||||
</AppContainer>
|
</AppContainer>
|
||||||
|
|
|
@ -25,7 +25,7 @@ export const AppCategory = ({ name, items }: IAppCategoryProps) => (
|
||||||
<App
|
<App
|
||||||
name={app.name}
|
name={app.name}
|
||||||
icon={app.icon}
|
icon={app.icon}
|
||||||
url={app.url}
|
URL={app.URL}
|
||||||
displayURL={app.displayURL}
|
displayURL={app.displayURL}
|
||||||
/>
|
/>
|
||||||
</Item>
|
</Item>
|
||||||
|
|
|
@ -5,24 +5,24 @@ import {
|
||||||
handleResponse,
|
handleResponse,
|
||||||
Headline,
|
Headline,
|
||||||
ListContainer,
|
ListContainer,
|
||||||
ErrorMessage
|
ErrorMessage,
|
||||||
} from "./elements";
|
} from "./elements";
|
||||||
|
|
||||||
const useAppData = () => {
|
const useAppData = () => {
|
||||||
const [appData, setAppData] = useState({
|
const [appData, setAppData] = useState({
|
||||||
categories: [],
|
categories: [],
|
||||||
apps: [],
|
apps: [],
|
||||||
error: false
|
error: false,
|
||||||
});
|
});
|
||||||
const fetchAppData = useCallback(() => {
|
const fetchAppData = useCallback(() => {
|
||||||
(process.env.NODE_ENV === "production"
|
(process.env.NODE_ENV === "production"
|
||||||
? fetch("/data/apps.json").then(handleResponse)
|
? fetch("/data/apps.json").then(handleResponse)
|
||||||
: import("./data/apps.json")
|
: import("./data/apps.json")
|
||||||
)
|
)
|
||||||
.then(jsonResponse => {
|
.then((jsonResponse) => {
|
||||||
setAppData({ ...jsonResponse, error: false });
|
setAppData({ ...jsonResponse, error: false });
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
setAppData({ categories: [], apps: [], error: error.message });
|
setAppData({ categories: [], apps: [], error: error.message });
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -35,8 +35,9 @@ const useAppData = () => {
|
||||||
|
|
||||||
const AppList = () => {
|
const AppList = () => {
|
||||||
const {
|
const {
|
||||||
appData: { categories, apps, error }
|
appData: { categories, apps, error },
|
||||||
} = useAppData();
|
} = useAppData();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListContainer>
|
<ListContainer>
|
||||||
<Headline>Applications</Headline>
|
<Headline>Applications</Headline>
|
||||||
|
|
Loading…
Reference in a new issue