Skip to content

Commit

Permalink
fix(Logo): remove aside header variables from logo (#210)
Browse files Browse the repository at this point in the history
Co-authored-by: kseniyakuzina <[email protected]>
  • Loading branch information
kseniya57 and kseniyakuzina authored Mar 20, 2024
1 parent b12ae34 commit 8228ce3
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
14 changes: 14 additions & 0 deletions src/components/AsideHeader/AsideHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ $block: '.#{variables.$ns}aside-header';
}
}

&__logo-button-wrapper {
width: var(--gn-aside-header-min-width);
}

&__logo-button[class] {
&,
.g-button__icon {
height: var(
--gn-aside-header-item-icon-background-size,
var(--_--item-icon-background-size)
);
}
}

&__menu-items {
flex-grow: 1;
}
Expand Down
8 changes: 7 additions & 1 deletion src/components/AsideHeader/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ export const Header = () => {

return (
<div className={b('header', {['with-decoration']: headerDecoration})}>
<Logo {...logo} onClick={onLogoClick} compact={compact} />
<Logo
{...logo}
onClick={onLogoClick}
compact={compact}
buttonWrapperClassName={b('logo-button-wrapper')}
buttonClassName={b('logo-button')}
/>

<CompositeBar
type="subheader"
Expand Down
8 changes: 0 additions & 8 deletions src/components/Logo/Logo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ $block: '.#{variables.$ns}logo';

&__logo-btn-place {
flex-shrink: 0;
width: var(--gn-aside-header-min-width);
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -23,13 +22,6 @@ $block: '.#{variables.$ns}logo';
}
}

&__btn-logo.g-button_view_flat.g-button_size_l {
--g-button-height: var(
--gn-aside-header-item-icon-background-size,
var(--_--item-icon-background-size)
);
}

&__logo {
@include text-body-2;
vertical-align: middle;
Expand Down
13 changes: 9 additions & 4 deletions src/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import './Logo.scss';

const b = block('logo');

export const Logo: React.FC<LogoProps & {compact?: boolean}> = ({
export const Logo: React.FC<
LogoProps & {compact?: boolean; buttonClassName?: string; buttonWrapperClassName?: string}
> = ({
text,
icon,
iconSrc,
Expand All @@ -21,6 +23,9 @@ export const Logo: React.FC<LogoProps & {compact?: boolean}> = ({
wrapper,
onClick,
compact,
className,
buttonWrapperClassName,
buttonClassName,
}) => {
const hasWrapper = typeof wrapper === 'function';

Expand All @@ -40,7 +45,7 @@ export const Logo: React.FC<LogoProps & {compact?: boolean}> = ({
<Button
view="flat"
size="l"
className={b('btn-logo')}
className={b('btn-logo', buttonClassName)}
component={hasWrapper ? 'span' : undefined}
onClick={onClick}
target={target}
Expand All @@ -64,8 +69,8 @@ export const Logo: React.FC<LogoProps & {compact?: boolean}> = ({
}

return (
<div className={b()}>
<div className={b('logo-btn-place')}>
<div className={b(null, className)}>
<div className={b('logo-btn-place', buttonWrapperClassName)}>
{hasWrapper ? wrapper(button, Boolean(compact)) : button}
</div>
{!compact &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/MobileLogo/MobileLogo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $block: '.#{variables.$ns}mobile-logo';
align-items: center;
overflow: hidden;

gap: 8px;
gap: var(--g-spacing-2);

&:is(a) {
&,
Expand Down
5 changes: 3 additions & 2 deletions src/components/MobileLogo/MobileLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const MobileLogo: React.FC<MobileLogoProps> = ({
target = '_self',
wrapper,
onClick,
className,
}) => {
const hasClickHandler = typeof onClick === 'function';
const hasWrapper = typeof wrapper === 'function';
Expand Down Expand Up @@ -73,11 +74,11 @@ export const MobileLogo: React.FC<MobileLogoProps> = ({
);

return hasWrapper ? (
<div className={b()} onClick={onClick}>
<div className={b(null, className)} onClick={onClick}>
{wrapper(logo, compact)}
</div>
) : (
<a {...linkProps} className={b()} onClick={onClick}>
<a {...linkProps} className={b(null, className)} onClick={onClick}>
{logo}
</a>
);
Expand Down
1 change: 1 addition & 0 deletions src/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type SubheaderMenuItem = Omit<ItemProps, 'onItemClick' | 'onItemClickCapt

export interface LogoProps {
text: (() => React.ReactNode) | string;
className?: string;
icon?: IconProps['data'];
iconSrc?: string;
iconClassName?: string;
Expand Down

0 comments on commit 8228ce3

Please sign in to comment.