Skip to content
Open
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
73 changes: 44 additions & 29 deletions src/components/AsideHeader/README-ru.md

Large diffs are not rendered by default.

73 changes: 44 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 @@ -72,7 +72,7 @@
const openModalCount = data?.meta?.layers?.filter(
({type}) => type === 'modal',
).length;
callback(openModalCount !== 0);

Check warning on line 75 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Expected return with your callback function
}
});
};
Expand Down Expand Up @@ -109,20 +109,18 @@
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 @@
},
},
{
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 @@ -155,34 +151,32 @@
multipleTooltip={multipleTooltip}
openModalSubscriber={openModalSubscriber}
topAlert={topAlert}
renderFooter={({compact, asideRef}) => (

Check warning on line 154 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

'compact' is already declared in the upper scope on line 62 column 12
<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 @@
}}
/>
<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 Expand Up @@ -287,8 +278,8 @@
onChangeCompact={(v) => {
setCompact(v);
}}
onMenuMoreClick={() => console.log('onMenuMoreClick')}

Check warning on line 281 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
onAllPagesClick={() => console.log('onAllPagesClick')}

Check warning on line 282 in src/components/AsideHeader/__stories__/AsideHeaderShowcase.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
editMenuProps={{
enableSorting: true,
}}
Expand Down
7 changes: 1 addition & 6 deletions src/components/AsideHeader/__stories__/moc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ 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,
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 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
Loading