Skip to content

Commit

Permalink
Make entire homepage card clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
garryod committed May 30, 2023
1 parent 55c4335 commit c24c8ec
Showing 1 changed file with 42 additions and 31 deletions.
73 changes: 42 additions & 31 deletions backstage/packages/app/src/components/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { configApiRef, useApi } from '@backstage/core-plugin-api';
import {
Button,
Card,
CardActionArea,
CardActions,
CardContent,
Grid,
Expand All @@ -15,52 +16,62 @@ import { useNavigate } from 'react-router-dom';

const SoftwareCatalogCard = () => {
const navigate = useNavigate();
const handleOnClick = () => navigate('/catalog');
const orgName =
useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';

return (
<Card style={{ height: '100%' }}>
<CardContent>
<Typography variant="h5">
<CategoryIcon /> Software Catalog
</Typography>
<Typography variant="body2">
A central location to discover software components developed at{' '}
{orgName}.
</Typography>
</CardContent>
<CardActions>
<Button size="medium" color="primary" onClick={handleOnClick}>
Visit
</Button>
</CardActions>
<Card>
<CardActionArea onClick={() => navigate('/catalog')}>
<CardContent>
<Typography variant="h5">
<CategoryIcon /> Software Catalog
</Typography>
<Typography variant="body2">
A central location to discover software components developed at{' '}
{orgName}.
</Typography>
</CardContent>
<CardActions>
<Button
size="medium"
color="primary"
onClick={() => navigate('/catalog')}
>
Visit
</Button>
</CardActions>
</CardActionArea>
</Card>
);
};

const DeveloperGuideCard = () => {
const navigate = useNavigate();
const handleOnClick = () => navigate('/guide');
const orgName =
useApi(configApiRef).getOptionalString('organization.name') ?? 'Backstage';

return (
<Card style={{ height: '100%' }}>
<CardContent>
<Typography variant="h5">
<LibraryBooksIcon /> Developer Guide
</Typography>
<Typography variant="body2">
Extensive documentation on developing software at {orgName}. Including
Tutorials, How-Tos, Explanations & References.
</Typography>
</CardContent>
<CardActions>
<Button size="medium" color="primary" onClick={handleOnClick}>
Visit
</Button>
</CardActions>
<CardActionArea onClick={() => navigate('/guide')}>
<CardContent>
<Typography variant="h5">
<LibraryBooksIcon /> Developer Guide
</Typography>
<Typography variant="body2">
Extensive documentation on developing software at {orgName}.
Including Tutorials, How-Tos, Explanations & References.
</Typography>
</CardContent>
<CardActions>
<Button
size="medium"
color="primary"
onClick={() => navigate('/guide')}
>
Visit
</Button>
</CardActions>
</CardActionArea>
</Card>
);
};
Expand Down

0 comments on commit c24c8ec

Please sign in to comment.