Merge pull request #26697 from overleaf/td-custom-logo-sp
Restore custom logo feature on SP project dashboard GitOrigin-RevId: c3ceafa8756968bfbb92f3fca22889e11a39dc40
This commit is contained in:
+19
-3
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { sendMB } from '@/infrastructure/event-tracking'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Button, Container, Nav, Navbar } from 'react-bootstrap'
|
||||
@@ -13,9 +13,15 @@ import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useContactUsModal } from '@/shared/hooks/use-contact-us-modal'
|
||||
import { UserProvider } from '@/shared/context/user-context'
|
||||
import { X } from '@phosphor-icons/react'
|
||||
import overleafWhiteLogo from '@/shared/svgs/overleaf-white.svg'
|
||||
import overleafBlackLogo from '@/shared/svgs/overleaf-black.svg'
|
||||
import type { CSSPropertiesWithVariables } from '../../../../../../../types/css-properties-with-variables'
|
||||
|
||||
function DefaultNavbar(props: DefaultNavbarMetadata) {
|
||||
function DefaultNavbar(
|
||||
props: DefaultNavbarMetadata & { overleafLogo?: string }
|
||||
) {
|
||||
const {
|
||||
overleafLogo,
|
||||
customLogo,
|
||||
title,
|
||||
canDisplayAdminMenu,
|
||||
@@ -49,10 +55,20 @@ function DefaultNavbar(props: DefaultNavbarMetadata) {
|
||||
className="navbar-default navbar-main"
|
||||
expand="lg"
|
||||
onToggle={expanded => setExpanded(expanded)}
|
||||
style={
|
||||
{
|
||||
'--navbar-brand-image-default-url': `url("${overleafWhiteLogo}")`,
|
||||
'--navbar-brand-image-redesign-url': `url("${overleafBlackLogo}")`,
|
||||
} as CSSPropertiesWithVariables
|
||||
}
|
||||
>
|
||||
<Container className="navbar-container" fluid>
|
||||
<div className="navbar-header">
|
||||
<HeaderLogoOrTitle title={title} customLogo={customLogo} />
|
||||
<HeaderLogoOrTitle
|
||||
title={title}
|
||||
overleafLogo={overleafLogo}
|
||||
customLogo={customLogo}
|
||||
/>
|
||||
{enableUpgradeButton ? (
|
||||
<Button
|
||||
as="a"
|
||||
|
||||
+12
-3
@@ -2,11 +2,13 @@ import type { DefaultNavbarMetadata } from '@/features/ui/components/types/defau
|
||||
import getMeta from '@/utils/meta'
|
||||
|
||||
export default function HeaderLogoOrTitle({
|
||||
overleafLogo,
|
||||
customLogo,
|
||||
title,
|
||||
}: Pick<DefaultNavbarMetadata, 'customLogo' | 'title'>) {
|
||||
}: Pick<DefaultNavbarMetadata, 'customLogo' | 'title'> & {
|
||||
overleafLogo?: string
|
||||
}) {
|
||||
const { appName } = getMeta('ol-ExposedSettings')
|
||||
|
||||
if (customLogo) {
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
||||
@@ -24,9 +26,16 @@ export default function HeaderLogoOrTitle({
|
||||
</a>
|
||||
)
|
||||
} else {
|
||||
const style = overleafLogo
|
||||
? {
|
||||
style: {
|
||||
backgroundImage: `url("${overleafLogo}")`,
|
||||
},
|
||||
}
|
||||
: null
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
||||
<a href="/" aria-label={appName} className="navbar-brand" />
|
||||
<a href="/" aria-label={appName} className="navbar-brand" {...style} />
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user