File size: 1,696 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
import React from 'react'
import { Link } from 'react-router-dom'
import { cssClass, themeGet } from '@adminjs/design-system'
import { styled } from '@adminjs/design-system/styled-components'
import ViewHelpers from '../../../../backend/utils/view-helpers/view-helpers.js'
import { BrandingOptions } from '../../../../adminjs-options.interface.js'
import allowOverride from '../../../hoc/allow-override.js'
type Props = {
branding: BrandingOptions;
}
export const StyledLogo: any = styled(Link)`
text-align: center;
display: flex;
align-content: center;
justify-content: center;
flex-shrink: 0;
padding: ${themeGet('space', 'lg')} ${themeGet('space', 'xxl')} ${themeGet('space', 'xxl')};
text-decoration: none;
& > h1 {
text-decoration: none;
font-weight: ${themeGet('fontWeights', 'bolder')};
font-size: ${themeGet('fontWeights', 'bolder')};
color: ${themeGet('colors', 'grey80')};
font-size: ${themeGet('fontSizes', 'xl')};
line-height: ${themeGet('lineHeights', 'xl')};
}
& > img {
max-width: 170px;
}
&:hover h1 {
color: ${themeGet('colors', 'primary100')};
}
`
const h = new ViewHelpers()
const SidebarBranding: React.FC<Props> = (props) => {
const { branding } = props
const { logo, companyName } = branding
return (
<StyledLogo
className={cssClass('Logo')}
to={h.dashboardUrl()}
data-css="sidebar-logo"
>
{logo ? (
<img
src={logo}
alt={companyName}
/>
) : <h1>{companyName}</h1>}
</StyledLogo>
)
}
export default allowOverride(SidebarBranding, 'SidebarBranding')
export { SidebarBranding as OriginalSidebarBranding, SidebarBranding }
|