Skip to content

menubar: стилизация, сторисы#160

Open
khaliulin wants to merge 30 commits intostorybook-updatefrom
menu.Menubar
Open

menubar: стилизация, сторисы#160
khaliulin wants to merge 30 commits intostorybook-updatefrom
menu.Menubar

Conversation

@khaliulin
Copy link
Copy Markdown
Collaborator

No description provided.

@khaliulin khaliulin requested a review from Skosov March 20, 2026 11:53
Danil Khaliulin and others added 2 commits March 20, 2026 22:56
@Skosov
Copy link
Copy Markdown
Member

Skosov commented Mar 25, 2026

image Обрезается пример

@khaliulin
Copy link
Copy Markdown
Collaborator Author

@Skosov фикс высоты превью: 825acdd

Comment thread src/plugins/prime/theme3.0/css.ts Outdated
Comment thread .storybook/preview-head.html Outdated
Comment thread .storybook/preview-head.html Outdated
Comment thread src/plugins/prime/stories/Menu/MenuBar/MenuBar.template.js Outdated
Comment thread src/plugins/prime/stories/Menu/MenuBar/MenuBar.template.js Outdated
Comment thread src/plugins/prime/theme3.0/css.ts Outdated
<script setup lang="ts">
import { Badge } from 'primevue';

defineProps({
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Я так понимаю этот компонент сделан просто как пример чтобы заюзать в сторизе

Image

Но у нас же в фигме буквально отрисован ItemTemplate и я так понимаю это какой то стандартный кстом

Может его нормально типизировать, наверстать в соответсвии с представленным макетом и экспрортировать для использования? Вопрос к обсжудению, я не сильно настаиваю

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

меню бар в обертку, с простоым прокидыванием всего
МенюБарИтем наверстываем и тоже экспортироваем

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Имеет смысл сразу вынести МенюАйтем для переиспользования в остальных местах, если оно ложится

После Айтем использовать как слот в базовом компоненте

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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


defineProps({
item: {
type: Object,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

непонятно что передавать, типизируй через тс

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov фикс 3bfd84f

Вынесен переиспользуемый PBlockMenuItem с TS-типизацией
для использования через #item слот в любых меню-компонентах.
Создан PBlockMenubar по аналогии с PBlockTieredMenu.
Удалён старый MenubarItem.vue из stories.
</script>

<template>
<a v-bind="actionProps" class="p-menuitem-link">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Давай чтобы стили не конфликтвоали с праймом не будем испрользовать их классы

можем через p-block например писать и конкретно тут уже описать стили для кастом компонента scoped стилями

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov menubar: заменить p-menuitem классы на p-block-menuitem, scoped стили 745d384

<Description />

```javascript
import { Menubar } from 'primevue';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Импорт не из прайма тут

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov исправлено — импорт PBlockMenubar, PBlockMenuItem из @cdek-it/vue-ui-kit 9eb4cb5


<script setup>
import { ref } from 'vue';
import { PBlockMenubar } from '@/primeBlocks';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Импорт не из @/primeBlocks, а из кита

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov исправлено — импорт из @cdek-it/vue-ui-kit 9eb4cb5


<script setup>
import { ref } from 'vue';
import { PBlockMenubar, PBlockMenuItem } from '@/primeBlocks';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

кривой импорт

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov исправлено — импорт из @cdek-it/vue-ui-kit 9eb4cb5

<template v-if="$slots.end" #end>
<slot name="end" />
</template>
<template v-if="$slots.item" #item="slotProps">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

по умолчанию пусть в слот передается новый PBlockMenuItem

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov по умолчанию в item слоте рендерится PBlockMenuItem 9eb4cb5

description?: string;
badge?: string;
};
actionProps?: Record<string, unknown>;
Copy link
Copy Markdown
Member

@Skosov Skosov May 8, 2026

Choose a reason for hiding this comment

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

я не понимаю что принимает actionProps, если это атрибуты с a тега, то их не надо передавать как пропс, они должны наследоваться от a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov убран actionProps — атрибуты наследуются через $attrs 9eb4cb5

</script>

<template>
<a v-bind="actionProps" class="p-menuitem-link">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

веротяно сразу надо заложить передачу не as пропса, чтобы рисовать не только ссылкой, а например передавать компонент сверху

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov добавлен as проп для рендера произвольного компонента/тега 9eb4cb5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

если мы реализуем как кастомный дочерний компонент, то есть ли смысл в этом цссе в целом?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov убраны кастомные menuitem-классы из css, оставлены только базовые стили PrimeVue 9eb4cb5

template: `
<PBlockMenubar :model="items" v-bind="args">
<template #item="{ item, props, hasSubmenu }">
<PBlockMenuItem :item="item" v-bind="props.action" :has-submenu="hasSubmenu" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

для чего тут описывается слот, если PBlockMenuItem должен рисоваться сразу под капотом?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov убран слот — PBlockMenuItem рендерится под капотом по умолчанию 2b649b9

<slot name="item" v-bind="slotProps">
<PBlockMenuItem
:item="slotProps.item"
:has-submenu="slotProps.hasSubmenu"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

has-submenu кажется должен вычисляться по наличию items у основного элемента

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov hasSubmenu теперь computed из item.items — проп убран 0687732

description?: string;
badge?: string;
};
as?: string | Component;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

где пример передачи через as?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov добавлен story WithItemAs с примером item-as="button" 0687732

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

вообще будто полностью надо заэкстендиться от MenuItem, чтоб не прокидывать пропсы объектом сюда

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov IPBlockMenuItem теперь extends MenuItem — пропсы label, icon, items и т.д. напрямую, без объекта item 9dba3e4

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov IPBlockMenuItem теперь extends MenuItem — пропсы label, icon, items и т.д. напрямую, без объекта item 9dba3e4

</template>
<template #item="slotProps">
<slot name="item" v-bind="slotProps">
<PBlockMenuItem
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Где прокидывание as?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov добавлен проп itemAs в PBlockMenubar, прокидывается в PBlockMenuItem 0687732

color: ${dt('menubar.extend.extSubmenuLabel.color')};
}

.p-menubar-mobile-button-icon {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

какой-то интересный селектор, откуда он?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov убран селектор .p-menubar-mobile-button-icon 0687732

Copy link
Copy Markdown
Member

@Skosov Skosov May 8, 2026

Choose a reason for hiding this comment

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

Покажи истории с разными слотами, кажется, что оно вместе не факт, что работает

https://primevue.org/menubar/#api.menubar.slots

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov добавлен story WithSlots с демонстрацией слотов start, item, end 839b822

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

а остальные слоты?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@Skosov добавлены слоты itemicon и submenuicon в WithSlots story aa83b86

Danil Khaliulin added 13 commits May 8, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants