Refactored menu css

pull/5677/head
Cagatay Civici 2024-04-09 14:59:41 +03:00
parent 7b0c4450a7
commit 0f716d4e16
2 changed files with 26 additions and 27 deletions

View File

@ -9,21 +9,21 @@ const classes = {
} }
], ],
start: 'p-menu-start', start: 'p-menu-start',
menu: 'p-menu-list p-reset', menu: 'p-menu-list',
submenuHeader: 'p-submenu-header', submenuHeader: 'p-menu-submenu-item',
separator: 'p-menuitem-separator', separator: 'p-menu-separator',
end: 'p-menu-end', end: 'p-menu-end',
menuitem: ({ instance }) => [ menuitem: ({ instance }) => [
'p-menuitem', 'p-menu-item',
{ {
'p-focus': instance.id === instance.focusedOptionId, 'p-focus': instance.id === instance.focusedOptionId,
'p-disabled': instance.disabled() 'p-disabled': instance.disabled()
} }
], ],
content: 'p-menuitem-content', content: 'p-menu-item-content',
action: 'p-menuitem-link', action: 'p-menu-item-link',
icon: 'p-menuitem-icon', icon: 'p-menu-item-icon',
label: 'p-menuitem-text' label: 'p-menu-item-text'
}; };
export default BaseStyle.extend({ export default BaseStyle.extend({

View File

@ -9,25 +9,25 @@ export default {
min-width: 12.5rem; min-width: 12.5rem;
} }
.p-menu ul { .p-menu-list {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
} }
.p-menu .p-menuitem { .p-menu-item {
margin: 2px 0; margin: 2px 0;
} }
.p-menu .p-menuitem:first-child { .p-menu-item:first-child {
margin-top: 0; margin-top: 0;
} }
.p-menu .p-menuitem:last-child { .p-menu-item:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
.p-menu .p-menuitem-link { .p-menu-item-link {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
@ -39,52 +39,51 @@ export default {
user-select: none; user-select: none;
} }
.p-menu .p-menuitem-text { .p-menu-item-content {
line-height: 1;
}
.p-menu .p-menuitem-content {
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')}; transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('rounded.sm')}; border-radius: ${dt('rounded.sm')};
color: ${dt('menu.item.color')}; color: ${dt('menu.item.color')};
} }
.p-menu .p-menuitem-icon { .p-menu-item-text {
line-height: 1;
}
.p-menu-item-icon {
color: ${dt('menu.item.icon.color')}; color: ${dt('menu.item.icon.color')};
margin-right: 0.5rem; margin-right: 0.5rem;
} }
.p-menu .p-menuitem.p-focus .p-menuitem-content { .p-menu-item.p-focus .p-menu-item-content {
color: ${dt('menu.item.focus.color')}; color: ${dt('menu.item.focus.color')};
background: ${dt('menu.item.focus.background')}; background: ${dt('menu.item.focus.background')};
} }
.p-menu .p-menuitem.p-focus .p-menuitem-icon { .p-menu-item.p-focus .p-menu-item-icon {
color: ${dt('menu.item.icon.focus.color')}; color: ${dt('menu.item.icon.focus.color')};
} }
.p-menu .p-menuitem:not(.p-disabled) .p-menuitem-content:hover { .p-menu-item:not(.p-disabled) .p-menu-item-content:hover {
color: ${dt('menu.item.focus.color')}; color: ${dt('menu.item.focus.color')};
background: ${dt('menu.item.focus.background')}; background: ${dt('menu.item.focus.background')};
} }
.p-menu .p-menuitem:not(.p-disabled) .p-menuitem-content:hover .p-menuitem-icon, .p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {
.p-menu .p-menuitem:not(.p-disabled) .p-menuitem-content:hover .p-submenu-icon {
color: ${dt('menu.item.icon.focus.color')}; color: ${dt('menu.item.icon.focus.color')};
} }
.p-menu.p-menu-overlay { .p-menu-overlay {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
} }
.p-menu .p-submenu-header { .p-menu-submenu-item {
margin: 0; margin: 0;
padding: 0.5rem 0.75rem; padding: 0.5rem 0.75rem;
color: ${dt('menu.submenu.header.color')}; color: ${dt('menu.submenu.header.color')};
font-weight: 600; font-weight: 600;
} }
.p-menu .p-menuitem-separator { .p-menu-separator {
border-top: 1px solid ${dt('menu.separator.border.color.color')}; border-top: 1px solid ${dt('menu.separator.border.color.color')};
margin: 2px 0; margin: 2px 0;
} }