Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEN-168 Make logo sx props customizable #233

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @baseapp-frontend/components

## 1.0.25

### Patch Changes

- Forward LogoProps to make them customizable

## 1.0.24

### Patch Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Header: FC<HeaderProps> = ({
children,
onOpenNav,
LogoIcon,
LogoProps,
AccountMenu = DefaultAccountMenu,
AccountMenuProps,
ToolbarProps,
Expand All @@ -37,8 +38,10 @@ const Header: FC<HeaderProps> = ({
>
{LogoIcon && (isNavHorizontal || isNavCentered) && (
<Logo
{...LogoProps}
sx={{
display: { xs: 'none', lg: 'flex' },
...LogoProps?.sx,
}}
>
<LogoIcon />
Expand Down
2 changes: 2 additions & 0 deletions packages/components/modules/navigations/web/Header/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, PropsWithChildren } from 'react'

import { PartialLogoProps } from '@baseapp-frontend/design-system/components/web/logos'
import { ThemeLayout, UISettings } from '@baseapp-frontend/design-system/styles/web'

import { AppBarProps, ToolbarProps as MuiToolbarProps } from '@mui/material'
Expand All @@ -14,6 +15,7 @@ export interface HeaderProps extends PropsWithChildren {
settings: UISettings
onOpenNav?: VoidFunction
LogoIcon?: React.FC
LogoProps?: PartialLogoProps
AccountMenu?: FC<AccountMenuProps>
AccountMenuProps?: Partial<AccountMenuProps>
ToolbarProps?: MuiToolbarProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const NavMini: FC<NavMiniProps> = ({
settings,
setSettings,
LogoIcon,
LogoProps,
openNav,
onCloseNav,
hideToggleButton = false,
Expand Down Expand Up @@ -59,7 +60,7 @@ const NavMini: FC<NavMiniProps> = ({
}}
>
{LogoIcon && (
<Logo sx={{ mx: 'auto', my: 2 }}>
<Logo {...LogoProps} sx={{ mx: 'auto', my: 2, ...LogoProps?.sx }}>
<LogoIcon />
</Logo>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PartialLogoProps } from '@baseapp-frontend/design-system/components/web/logos'
import { UISettings } from '@baseapp-frontend/design-system/styles/web'

import { NavigationData } from '../types'
Expand All @@ -9,5 +10,6 @@ export interface NavMiniProps {
settings: UISettings
setSettings: (newSettings: Partial<UISettings>) => void
LogoIcon?: React.FC
LogoProps?: PartialLogoProps
hideToggleButton?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const NavVertical: FC<NavVerticalProps> = ({
setSettings,
navData,
LogoIcon,
LogoProps,
openNav,
onCloseNav,
hideToggleButton = false,
Expand Down Expand Up @@ -58,7 +59,7 @@ const NavVertical: FC<NavVerticalProps> = ({
}}
>
{LogoIcon && (
<Logo sx={{ mt: 3, ml: 4, mb: 1 }}>
<Logo {...LogoProps} sx={{ mt: 3, ml: 4, mb: 1, ...LogoProps?.sx }}>
<LogoIcon />
</Logo>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PartialLogoProps } from '@baseapp-frontend/design-system/components/web/logos'
import { UISettings } from '@baseapp-frontend/design-system/styles/web'

import { NavigationData } from '../types'
Expand All @@ -7,6 +8,7 @@ export interface NavVerticalProps {
setSettings: (newSettings: Partial<UISettings>) => void
navData: NavigationData
LogoIcon?: React.FC
LogoProps?: PartialLogoProps
openNav: boolean
onCloseNav: VoidFunction
hideToggleButton?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
settings,
setSettings,
LogoIcon,
LogoProps,
AccountMenu,
AccountMenuProps,
ToolbarProps,
Expand All @@ -36,6 +37,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
<Header
settings={settings}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
onOpenNav={nav.onTrue}
AccountMenu={AccountMenu}
AccountMenuProps={AccountMenuProps}
Expand All @@ -54,6 +56,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
<Header
settings={settings}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
onOpenNav={nav.onTrue}
AccountMenu={AccountMenu}
AccountMenuProps={AccountMenuProps}
Expand All @@ -71,6 +74,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
<Header
settings={settings}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
onOpenNav={nav.onTrue}
AccountMenu={AccountMenu}
AccountMenuProps={AccountMenuProps}
Expand All @@ -89,6 +93,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
openNav={nav.value}
onCloseNav={nav.onFalse}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
settings={settings}
setSettings={setSettings}
/>
Expand All @@ -103,6 +108,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
<Header
settings={settings}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
onOpenNav={nav.onTrue}
AccountMenu={AccountMenu}
AccountMenuProps={AccountMenuProps}
Expand All @@ -120,6 +126,7 @@ const NavigationLayout: FC<NavigationLayoutProps> = ({
settings={settings}
setSettings={setSettings}
LogoIcon={LogoIcon}
LogoProps={LogoProps}
openNav={nav.value}
onCloseNav={nav.onFalse}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, PropsWithChildren } from 'react'

import { PartialLogoProps } from '@baseapp-frontend/design-system/components/web/logos'
import { UISettings } from '@baseapp-frontend/design-system/styles/web'

import { ToolbarProps as MuiToolbarProps } from '@mui/material'
Expand All @@ -12,6 +13,7 @@ export interface NavigationLayoutProps extends PropsWithChildren {
settings: UISettings
setSettings: (newSettings: Partial<UISettings>) => void
LogoIcon?: React.FC
LogoProps?: PartialLogoProps
AccountMenu?: FC<AccountMenuProps>
AccountMenuProps?: Partial<AccountMenuProps>
ToolbarProps?: MuiToolbarProps
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@baseapp-frontend/components",
"description": "BaseApp components modules such as comments, notifications, messages, and more.",
"version": "1.0.24",
"version": "1.0.25",
"sideEffects": false,
"scripts": {
"babel:transpile": "babel modules -d tmp-babel --extensions .ts,.tsx --ignore '**/__tests__/**','**/__storybook__/**'",
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/components/web/logos/Logo/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ export interface LogoProps extends BoxProps {
children: React.ReactNode
disabledLink?: boolean
}

export type PartialLogoProps = Omit<LogoProps, 'ref' | 'children'>
Loading