Open christophe-f opened 1 year ago
The rebrand plugin is a front end plugin.
rebrand
The plugin should display a form and let the user upload a custom logo and primary color to rebrand Backstage. (More UI tweaks could be added later)
No response
The form should contain:
The plugin will provide a wrapper similar to:
import React, { ReactElement, ReactNode, useEffect, useState } from 'react'; import { BackstageTheme } from '@backstage/theme'; import { lightTheme } from '@backstage/theme'; import { CssBaseline, ThemeProvider } from '@material-ui/core'; type Props = { children: ReactElement | ReactNode; }; export function ThemeWrapper({ children }: Props) { const [isLoading, setIsLoading] = useState<boolean>(false); const [theme, setTheme] = useState<BackstageTheme>(lightTheme); useEffect(() => { setIsLoading(true); fetch('http://localhost:3000/branding/branding.json', { headers: { 'Content-Type': 'application/json', }, }) .then(response => response.json()) .then(json => { theme.palette.primary.main = json.theme.primary; theme.palette.navigation.color = json.theme.primary; setTheme(theme); }) .catch(() => {}) .finally(() => { setIsLoading(false); }); }, []); return ( <> {!isLoading && ( <ThemeProvider theme={theme}> <CssBaseline>{children}</CssBaseline> </ThemeProvider> )} </> ); }
When the Backstage theme is added to App.tsx, the wrapper can be used:
App.tsx
const app = createApp({ ... themes: [ { id: 'janus', title: 'Janus Theme', icon: <LightIcon />, variant: 'light', Provider: ({ children }) => <ThemeWrapper>{children}</ThemeWrapper>, }, ], });
The /image/{name} endpoint from the rebrand-backend plugin will retrieve the logo and can be used in the LogoFull.tsx and LogoIcon.tsx files.
/image/{name}
rebrand-backend
LogoFull.tsx
LogoIcon.tsx
No, but I'm happy to collaborate on a PR with someone else
Do we already have a certain mount point where the server can save client-uploaded assets, or a flow for doing this? Or would we instead want to just use something like S3/Minio to upload & retrieve from?
š Summary
The
rebrand
plugin is a front end plugin.The plugin should display a form and let the user upload a custom logo and primary color to rebrand Backstage. (More UI tweaks could be added later)
š Project website (if applicable)
No response
āļø Context
The form should contain:
The plugin will provide a wrapper similar to:
When the Backstage theme is added to
App.tsx
, the wrapper can be used:The
/image/{name}
endpoint from therebrand-backend
plugin will retrieve the logo and can be used in theLogoFull.tsx
andLogoIcon.tsx
files.š Have you spent some time to check if this plugin request has been raised before?
š¢ Have you read the Code of Conduct?
Are you willing to submit PR?
No, but I'm happy to collaborate on a PR with someone else