-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from awanlin/feat/add-home-plugin
feat: added Home plugin
- Loading branch information
Showing
10 changed files
with
8,829 additions
and
10,725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { Page, Content } from '@backstage/core-components'; | ||
import { | ||
HomePageCompanyLogo, | ||
TemplateBackstageLogo, | ||
HomePageStarredEntities, | ||
HomePageToolkit, | ||
CustomHomepageGrid, | ||
HomePageRandomJoke, | ||
HomePageTopVisited, | ||
HomePageRecentlyVisited, | ||
} from '@backstage/plugin-home'; | ||
import { HomePageSearchBar } from '@backstage/plugin-search'; | ||
import { Grid } from '@material-ui/core'; | ||
import React from 'react'; | ||
import { tools, useLogoStyles } from './shared'; | ||
|
||
const defaultConfig = [ | ||
{ | ||
component: 'HomePageSearchBar', | ||
x: 0, | ||
y: 0, | ||
width: 24, | ||
height: 2, | ||
}, | ||
{ | ||
component: 'HomePageRecentlyVisited', | ||
x: 0, | ||
y: 1, | ||
width: 5, | ||
height: 4, | ||
}, | ||
{ | ||
component: 'HomePageTopVisited', | ||
x: 5, | ||
y: 1, | ||
width: 5, | ||
height: 4, | ||
}, | ||
{ | ||
component: 'HomePageStarredEntities', | ||
x: 0, | ||
y: 2, | ||
width: 6, | ||
height: 4, | ||
}, | ||
{ | ||
component: 'HomePageToolkit', | ||
x: 6, | ||
y: 6, | ||
width: 4, | ||
height: 4, | ||
}, | ||
]; | ||
|
||
export const CustomizableHomePage = () => { | ||
const { svg, path, container } = useLogoStyles(); | ||
|
||
return ( | ||
<Page themeId="home"> | ||
<Content> | ||
<Grid container justifyContent="center"> | ||
<HomePageCompanyLogo | ||
className={container} | ||
logo={<TemplateBackstageLogo classes={{ svg, path }} />} | ||
/> | ||
</Grid> | ||
|
||
<CustomHomepageGrid config={defaultConfig}> | ||
<HomePageSearchBar /> | ||
<HomePageRecentlyVisited /> | ||
<HomePageTopVisited /> | ||
<HomePageToolkit tools={tools} /> | ||
<HomePageStarredEntities /> | ||
<HomePageRandomJoke /> | ||
</CustomHomepageGrid> | ||
</Content> | ||
</Page> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Page, Content } from '@backstage/core-components'; | ||
import { | ||
HomePageCompanyLogo, | ||
TemplateBackstageLogo, | ||
HomePageStarredEntities, | ||
HomePageToolkit, | ||
HomePageTopVisited, | ||
HomePageRecentlyVisited, | ||
} from '@backstage/plugin-home'; | ||
import { HomePageSearchBar } from '@backstage/plugin-search'; | ||
import { SearchContextProvider } from '@backstage/plugin-search-react'; | ||
import { Grid, makeStyles } from '@material-ui/core'; | ||
import React from 'react'; | ||
import { tools, useLogoStyles } from './shared'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
searchBarInput: { | ||
maxWidth: '60vw', | ||
margin: 'auto', | ||
backgroundColor: theme.palette.background.paper, | ||
borderRadius: '50px', | ||
boxShadow: theme.shadows[1], | ||
}, | ||
searchBarOutline: { | ||
borderStyle: 'none', | ||
}, | ||
})); | ||
|
||
export const HomePage = () => { | ||
const classes = useStyles(); | ||
const { svg, path, container } = useLogoStyles(); | ||
|
||
return ( | ||
<SearchContextProvider> | ||
<Page themeId="home"> | ||
<Content> | ||
<Grid container justifyContent="center" spacing={2}> | ||
<HomePageCompanyLogo | ||
className={container} | ||
logo={<TemplateBackstageLogo classes={{ svg, path }} />} | ||
/> | ||
<Grid container item xs={12} justifyContent="center"> | ||
<HomePageSearchBar | ||
InputProps={{ | ||
classes: { | ||
root: classes.searchBarInput, | ||
notchedOutline: classes.searchBarOutline, | ||
}, | ||
}} | ||
placeholder="Search" | ||
/> | ||
</Grid> | ||
<Grid container item xs={12}> | ||
<Grid item xs={12} md={6}> | ||
<HomePageTopVisited /> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<HomePageRecentlyVisited /> | ||
</Grid> | ||
</Grid> | ||
<Grid container item xs={12}> | ||
<Grid item xs={7}> | ||
<HomePageStarredEntities /> | ||
</Grid> | ||
<Grid item xs={5}> | ||
<HomePageToolkit tools={tools} /> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Content> | ||
</Page> | ||
</SearchContextProvider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { TemplateBackstageLogoIcon } from '@backstage/plugin-home'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import React from 'react'; | ||
|
||
export const useLogoStyles = makeStyles(theme => ({ | ||
container: { | ||
margin: theme.spacing(5, 0), | ||
}, | ||
svg: { | ||
width: 'auto', | ||
height: 100, | ||
}, | ||
path: { | ||
fill: '#7df3e1', | ||
}, | ||
})); | ||
|
||
export const tools = [ | ||
{ | ||
url: 'https://backstage.io/docs', | ||
label: 'Docs', | ||
icon: <TemplateBackstageLogoIcon />, | ||
}, | ||
{ | ||
url: 'https://github.com/backstage/backstage', | ||
label: 'GitHub', | ||
icon: <TemplateBackstageLogoIcon />, | ||
}, | ||
{ | ||
url: 'https://github.com/backstage/backstage/blob/master/CONTRIBUTING.md', | ||
label: 'Contributing', | ||
icon: <TemplateBackstageLogoIcon />, | ||
}, | ||
{ | ||
url: 'https://backstage.io/plugins', | ||
label: 'Plugins Directory', | ||
icon: <TemplateBackstageLogoIcon />, | ||
}, | ||
{ | ||
url: 'https://github.com/backstage/backstage/issues/new/choose', | ||
label: 'Submit New Issue', | ||
icon: <TemplateBackstageLogoIcon />, | ||
}, | ||
]; |
Oops, something went wrong.