Skip to content
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
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {withMobile} from './decorators/withMobile';
import {withLang} from './decorators/withLang';

import './styles.scss';

import '@gravity-ui/uikit/styles/styles.css';

uiKitConfigure({
Expand Down
37 changes: 0 additions & 37 deletions src/components/AllPagesPanel/useGroupedMenuItems.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/components/AllPagesPanel/useVisibleMenuItems.ts

This file was deleted.

10 changes: 4 additions & 6 deletions src/components/AsideHeader/AsideHeaderContext.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';

import {MenuItem} from '../types';

import {AsideHeaderInnerProps} from './types';
import {AsideHeaderInnerProps, AsideHeaderItem} from './types';

export interface AsideHeaderInnerContextType extends AsideHeaderInnerProps {
menuItems: MenuItem[];
defaultMenuItems?: MenuItem[];
menuItems: AsideHeaderItem[];
defaultMenuItems?: AsideHeaderItem[];
allPagesIsAvailable: boolean;
onItemClick: (
item: MenuItem,
item: AsideHeaderItem,
collapsed: boolean,
event: React.MouseEvent<HTMLElement, MouseEvent>,
) => void;
Expand Down
112 changes: 83 additions & 29 deletions src/components/AsideHeader/README-ru.md

Large diffs are not rendered by default.

112 changes: 83 additions & 29 deletions src/components/AsideHeader/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@import '../../../../styles/mixins';
@use '../../../../styles/mixins';

body {
margin: 0;
}

.aside-header-showcase {
&__content {
@include text-body-3;
@include mixins.text-body-3;
padding: 40px;
}

Expand Down Expand Up @@ -71,7 +71,7 @@ body {
}

&__item-accent {
@include text-accent;
@include mixins.text-accent;
width: 100%;
height: 100%;
}
Expand Down
139 changes: 65 additions & 74 deletions src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,18 @@ export const AsideHeaderShowcase: React.FC<AsideHeaderShowcaseProps> = ({
customBackgroundClassName={customBackgroundClassName}
subheaderItems={[
{
item: {
id: 'services',
title: 'Services',
icon: Gear,
onItemClick: () => {
setVisiblePanel(undefined);
setSubheaderPopupVisible(!subheaderPopupVisible);
},
id: 'services',
title: 'Services',
icon: Gear,
onItemClick: () => {
setVisiblePanel(undefined);
setSubheaderPopupVisible(!subheaderPopupVisible);
},
popupAnchor: ref,
popupRef: ref,
popupPlacement: ['right-start'],
popupOffset: {mainAxis: 10, crossAxis: 10},
popupVisible: subheaderPopupVisible,
onClosePopup: () => setSubheaderPopupVisible(false),
onOpenChangePopup: () => setSubheaderPopupVisible(false),
renderPopupContent: () => {
return (
<div className={b('settings')}>
Expand All @@ -137,17 +135,15 @@ export const AsideHeaderShowcase: React.FC<AsideHeaderShowcaseProps> = ({
},
},
{
item: {
id: 'search',
title: 'Search',
qa: 'subheader-item-search',
icon: Magnifier,
current: visiblePanel === Panel.Search,
onItemClick: () =>
setVisiblePanel(
visiblePanel === Panel.Search ? undefined : Panel.Search,
),
},
id: 'search',
title: 'Search',
qa: 'subheader-item-search',
icon: Magnifier,
current: visiblePanel === Panel.Search,
onItemClick: () =>
setVisiblePanel(
visiblePanel === Panel.Search ? undefined : Panel.Search,
),
},
]}
compact={compact}
Expand All @@ -159,30 +155,28 @@ export const AsideHeaderShowcase: React.FC<AsideHeaderShowcaseProps> = ({
<React.Fragment>
<FooterItem
compact={compact}
item={{
id: 'infra',
icon: Gear,
current: popupVisible,
qa: 'footer-item-gear',
iconQa: 'footer-item-icon-gear',
title: (
<div className={b('infra-text')}>
<span className={b('infra-label')}>Minor issue</span>
<span className={b('infra-period')}>Now</span>
</div>
),
tooltipText: 'Minor issue (Now)',
onItemClick: () => {
setVisiblePanel(undefined);
setPopupVisible(!popupVisible);
},
id={'infra'}
icon={Gear}
current={popupVisible}
qa={'footer-item-gear'}
iconQa={'footer-item-icon-gear'}
title={
<div className={b('infra-text')}>
<span className={b('infra-label')}>Minor issue</span>
<span className={b('infra-period')}>Now</span>
</div>
}
tooltipText={'Minor issue (Now)'}
onItemClick={() => {
setVisiblePanel(undefined);
setPopupVisible(!popupVisible);
}}
enableTooltip={false}
popupVisible={popupVisible}
popupAnchor={asideRef}
popupRef={asideRef}
popupPlacement={['right-end']}
popupOffset={{mainAxis: 10, crossAxis: 10}}
onClosePopup={() => setPopupVisible(false)}
onOpenChangePopup={() => setPopupVisible(false)}
popupKeepMounted={true}
renderPopupContent={() => {
return (
Expand All @@ -198,45 +192,42 @@ export const AsideHeaderShowcase: React.FC<AsideHeaderShowcaseProps> = ({
}}
/>
<FooterItem
item={{
id: 'project-settings',
title: 'Settings with panel',
tooltipText: (
<div>
<b>Settings with panel</b>
</div>
),
current: visiblePanel === Panel.ProjectSettings,
itemWrapper: (params, makeItem) =>
makeItem({
...params,
icon: <Icon data={Bug} size={ASIDE_HEADER_ICON_SIZE} />,
}),
onItemClick: () => {
setVisiblePanel(
visiblePanel === Panel.ProjectSettings
? undefined
: Panel.ProjectSettings,
);
},
id={'project-settings'}
title={'Settings with panel'}
tooltipText={
<div>
<b>Settings with panel</b>
</div>
}
current={visiblePanel === Panel.ProjectSettings}
itemWrapper={(params, makeItem) =>
makeItem({
...params,
icon: <Icon data={Bug} size={ASIDE_HEADER_ICON_SIZE} />,
})
}
onItemClick={() => {
setVisiblePanel(
visiblePanel === Panel.ProjectSettings
? undefined
: Panel.ProjectSettings,
);
}}
bringForward
compact={compact}
/>
<FooterItem
item={{
id: 'user-settings',
icon: Gear,
title: 'User Settings with panel',
tooltipText: 'User Settings with panel',
current: visiblePanel === Panel.UserSettings,
onItemClick: () => {
setVisiblePanel(
visiblePanel === Panel.UserSettings
? undefined
: Panel.UserSettings,
);
},
id={'user-settings'}
icon={Gear}
title={'User Settings with panel'}
tooltipText={'User Settings with panel'}
current={visiblePanel === Panel.UserSettings}
onItemClick={() => {
setVisiblePanel(
visiblePanel === Panel.UserSettings
? undefined
: Panel.UserSettings,
);
}}
compact={compact}
/>
Expand Down
11 changes: 3 additions & 8 deletions src/components/AsideHeader/__stories__/moc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,18 @@ const MENU_ITEMS_CLAMPED: AsideHeaderProps['menuItems'] = [
title: MENU_ITEMS_CLAMPED_TITLE,
icon: Gear,
},
{
id: 'text-action',
title: MENU_ITEMS_CLAMPED_TITLE,
icon: Gear,
type: 'action',
},
{id: 'text-action', title: MENU_ITEMS_CLAMPED_TITLE, icon: Gear, type: 'action'},
{
id: 'text-link',
title: MENU_ITEMS_CLAMPED_TITLE,
icon: Gear,
link: 'about:blank',
href: 'about:blank',
},
{
id: 'text-link-action',
title: MENU_ITEMS_CLAMPED_TITLE,
icon: Gear,
link: 'about:blank',
href: 'about:blank',
type: 'action',
},
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '../../variables';
@use '../../../../styles/mixins';
@use '../../../../variables';
@use '../../../../../../styles/mixins';

.#{variables.$ns}all-pages-list-item {
@include mixins.accessibility-button;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import React, {MouseEvent, useCallback} from 'react';
import {Pin, PinFill} from '@gravity-ui/icons';
import {Button, Icon} from '@gravity-ui/uikit';

import {MenuItem} from '../../types';
import {block} from '../../utils/cn';
import {AsideHeaderItem} from 'src/components/AsideHeader/types';

import {block} from '../../../../utils/cn';

import './AllPagesListItem.scss';

const b = block('all-pages-list-item');

interface AllPagesListItemProps {
item: MenuItem;
item: AsideHeaderItem;
editMode?: boolean;
enableSorting?: boolean;
onToggle: () => void;
Expand All @@ -37,7 +38,7 @@ export const AllPagesListItem: React.FC<AllPagesListItemProps> = (props) => {
}
};

const [Tag, tagProps] = item.link ? ['a' as const, {href: item.link}] : ['button' as const, {}];
const [Tag, tagProps] = item.href ? ['a' as const, {href: item.href}] : ['button' as const, {}];

return (
<Tag {...tagProps} className={b()} onClick={onItemClick}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use '../variables';
@use '../../../variables';

.#{variables.$ns}all-pages-panel {
min-width: 300px;
Expand Down
Loading