-
-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow to pass uiConfig from server config to client. (#504)
feat: Allow to change board title feat: Allow to change board logo closes #503
- Loading branch information
Showing
13 changed files
with
124 additions
and
27 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
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 |
---|---|---|
@@ -1,16 +1,30 @@ | ||
import cn from 'clsx'; | ||
import React, { PropsWithChildren } from 'react'; | ||
import { useUIConfig } from '../../hooks/useUIConfig'; | ||
import s from './Header.module.css'; | ||
import { getStaticPath } from '../../utils/getStaticPath'; | ||
|
||
export const Header = ({ children }: PropsWithChildren<any>) => ( | ||
<header className={s.header}> | ||
<div className={s.logo}> | ||
<img src={getStaticPath('/images/logo.svg')} alt="Bull Dashboard" /> | ||
Bull Dashboard | ||
</div> | ||
<div className={cn(s.content, { [s.positionRight]: React.Children.count(children) === 1 })}> | ||
{children} | ||
</div> | ||
</header> | ||
); | ||
export const Header = ({ children }: PropsWithChildren<any>) => { | ||
const uiConfig = useUIConfig(); | ||
const logoPath = uiConfig.boardLogo?.path ?? getStaticPath('/images/logo.svg'); | ||
const boardTitle = uiConfig.boardTitle ?? 'Bull Dashboard'; | ||
return ( | ||
<header className={s.header}> | ||
<div className={s.logo}> | ||
{!!logoPath && ( | ||
<img | ||
src={logoPath} | ||
className={cn(s.img, { [s.default]: !uiConfig.boardLogo })} | ||
width={uiConfig.boardLogo?.width} | ||
height={uiConfig.boardLogo?.height} | ||
alt={boardTitle} | ||
/> | ||
)} | ||
{boardTitle} | ||
</div> | ||
<div className={cn(s.content, { [s.positionRight]: React.Children.count(children) === 1 })}> | ||
{children} | ||
</div> | ||
</header> | ||
); | ||
}; |
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,8 @@ | ||
import { UIConfig } from '@bull-board/api/dist/typings/app'; | ||
import React, { useContext } from 'react'; | ||
|
||
export const UIConfigContext = React.createContext<UIConfig>(null as any); | ||
|
||
export function useUIConfig() { | ||
return useContext(UIConfigContext); | ||
} |
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