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

fix(Logo): remove aside header variables from logo #210

Merged
merged 1 commit into from
Mar 20, 2024
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
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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an option not to use a class from uikit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see there is no api for that for now

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
Loading