Refactored contextmenu styles

pull/5677/head
Cagatay Civici 2024-04-09 16:21:05 +03:00
parent 1d1bfb3312
commit a66441355f
7 changed files with 53 additions and 55 deletions

View File

@ -9,20 +9,20 @@ const classes = {
], ],
menu: 'p-contextmenu-root-list', menu: 'p-contextmenu-root-list',
menuitem: ({ instance, processedItem }) => [ menuitem: ({ instance, processedItem }) => [
'p-menuitem', 'p-contextmenu-item',
{ {
'p-menuitem-active p-highlight': instance.isItemActive(processedItem), 'p-contextmenu-item-active': instance.isItemActive(processedItem),
'p-focus': instance.isItemFocused(processedItem), 'p-focus': instance.isItemFocused(processedItem),
'p-disabled': instance.isItemDisabled(processedItem) 'p-disabled': instance.isItemDisabled(processedItem)
} }
], ],
content: 'p-menuitem-content', content: 'p-contextmenu-item-content',
action: 'p-menuitem-link', action: 'p-contextmenu-item-link',
icon: 'p-menuitem-icon', icon: 'p-contextmenu-item-icon',
label: 'p-menuitem-text', label: 'p-contextmenu-item-label',
submenuIcon: 'p-submenu-icon', submenuIcon: 'p-contextmenu-submenu-icon',
submenu: 'p-submenu-list', submenu: 'p-contextmenu-submenu-list',
separator: 'p-menuitem-separator' separator: 'p-contextmenu-separator'
}; };
export default BaseStyle.extend({ export default BaseStyle.extend({

View File

@ -23,7 +23,7 @@ const classes = {
content: 'p-menu-item-content', content: 'p-menu-item-content',
action: 'p-menu-item-link', action: 'p-menu-item-link',
icon: 'p-menu-item-icon', icon: 'p-menu-item-icon',
label: 'p-menu-item-text' label: 'p-menu-item-label'
}; };
export default BaseStyle.extend({ export default BaseStyle.extend({

View File

@ -10,17 +10,15 @@ export default {
min-width: 12.5rem; min-width: 12.5rem;
} }
.p-contextmenu ul { .p-contextmenu-root-list,
.p-contextmenu-submenu-list {
margin: 0; margin: 0;
padding: 0; padding: 0;
list-style: none; list-style: none;
}
.p-contextmenu-root-list {
outline: 0 none; outline: 0 none;
} }
.p-contextmenu .p-submenu-list { .p-contextmenu-submenu-list {
position: absolute; position: absolute;
min-width: 100%; min-width: 100%;
z-index: 1; z-index: 1;
@ -32,7 +30,25 @@ export default {
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-contextmenu .p-menuitem-link { .p-contextmenu-item {
position: relative;
margin: 2px 0;
}
.p-contextmenu-item:first-child {
margin-top: 0;
}
.p-contextmenu-item:last-child {
margin-bottom: 0;
}
.p-contextmenu-item-content {
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('rounded.sm')};
color: ${dt('contextmenu.item.color')};
}
.p-contextmenu-item-link {
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
@ -44,34 +60,16 @@ export default {
user-select: none; user-select: none;
} }
.p-contextmenu .p-menuitem-text { .p-contextmenu-item-label {
line-height: 1; line-height: 1;
} }
.p-contextmenu .p-menuitem { .p-contextmenu-item-icon {
position: relative; color: ${dt('contextmenu.item.icon.color')};
margin: 2px 0;
}
.p-contextmenu .p-menuitem:first-child {
margin-top: 0;
}
.p-contextmenu .p-menuitem:last-child {
margin-bottom: 0;
}
.p-contextmenu .p-menuitem-content {
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('rounded.sm')};
color: ${dt('contextmenu.item.color')};
}
.p-contextmenu .p-menuitem-icon {
color: ${dt('contextmenu.item.icom.color')};
margin-right: 0.5rem; margin-right: 0.5rem;
} }
.p-contextmenu .p-submenu-icon { .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.color')}; color: ${dt('contextmenu.item.icon.color')};
margin-left: auto; margin-left: auto;
font-size: 0.875rem; font-size: 0.875rem;
@ -79,37 +77,37 @@ export default {
height: 0.875rem; height: 0.875rem;
} }
.p-contextmenu .p-menuitem.p-focus > .p-menuitem-content { .p-contextmenu-item.p-focus > .p-contextmenu-item-content {
color: ${dt('contextmenu.item.focus.color')}; color: ${dt('contextmenu.item.focus.color')};
background: ${dt('contextmenu.item.focus.background')}; background: ${dt('contextmenu.item.focus.background')};
} }
.p-contextmenu .p-menuitem.p-focus > .p-menuitem-content .p-menuitem-icon, .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon,
.p-contextmenu .p-menuitem.p-focus > .p-menuitem-content .p-submenu-icon { .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.focus.color')}; color: ${dt('contextmenu.item.icon.focus.color')};
} }
.p-contextmenu .p-menuitem:not(.p-disabled) > .p-menuitem-content:hover { .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {
color: ${dt('contextmenu.item.focus.color')}; color: ${dt('contextmenu.item.focus.color')};
background: ${dt('contextmenu.item.focus.background')}; background: ${dt('contextmenu.item.focus.background')};
} }
.p-contextmenu .p-menuitem:not(.p-disabled) > .p-menuitem-content:hover .p-menuitem-icon, .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon,
.p-contextmenu .p-menuitem:not(.p-disabled) > .p-menuitem-content:hover .p-submenu-icon { .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.focus.color')}; color: ${dt('contextmenu.item.icon.focus.color')};
} }
.p-contextmenu .p-menuitem.p-menuitem-active > .p-menuitem-content { .p-contextmenu-item-active > .p-contextmenu-item-content {
color: ${dt('contextmenu.item.focus.color')}; color: ${dt('contextmenu.item.focus.color')};
background: ${dt('contextmenu.item.focus.background')}; background: ${dt('contextmenu.item.focus.background')};
} }
.p-contextmenu .p-menuitem.p-menuitem-active > .p-menuitem-content .p-menuitem-icon, .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon,
.p-contextmenu .p-menuitem.p-menuitem-active > .p-menuitem-content .p-submenu-icon { .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
color: ${dt('contextmenu.item.icon.focus.color')}; color: ${dt('contextmenu.item.icon.focus.color')};
} }
.p-contextmenu .p-menuitem-separator { .p-contextmenu-separator {
border-top: 1px solid ${dt('contextmenu.separator.border.color')}; border-top: 1px solid ${dt('contextmenu.separator.border.color')};
margin: 2px 0; margin: 2px 0;
} }

View File

@ -45,7 +45,7 @@ export default {
color: ${dt('menu.item.color')}; color: ${dt('menu.item.color')};
} }
.p-menu-item-text { .p-menu-item-label {
line-height: 1; line-height: 1;
} }

View File

@ -60,7 +60,7 @@ export default {
user-select: none; user-select: none;
} }
.p-tieredmenu-item-text { .p-tieredmenu-item-label {
line-height: 1; line-height: 1;
} }

View File

@ -9,10 +9,10 @@ export default {
item: { item: {
focusBackground: '{surface.100}', focusBackground: '{surface.100}',
color: '{surface.700}', color: '{surface.700}',
colorFocus: '{surface.800}', focusColor: '{surface.800}',
icon: { icon: {
color: '{surface.400}', color: '{surface.400}',
colorFocus: '{surface.500}' focusColor: '{surface.500}'
} }
}, },
separator: { separator: {
@ -28,10 +28,10 @@ export default {
item: { item: {
focusBackground: '{surface.800}', focusBackground: '{surface.800}',
color: '{surface.0}', color: '{surface.0}',
colorFocus: '{surface.0}', focusColor: '{surface.0}',
icon: { icon: {
color: '{surface.500}', color: '{surface.500}',
colorFocus: '{surface.400}' focusColor: '{surface.400}'
} }
}, },
separator: { separator: {

View File

@ -25,7 +25,7 @@ const classes = {
content: 'p-tieredmenu-item-content', content: 'p-tieredmenu-item-content',
action: 'p-tieredmenu-item-link', action: 'p-tieredmenu-item-link',
icon: 'p-tieredmenu-item-icon', icon: 'p-tieredmenu-item-icon',
text: 'p-tieredmenu-item-text', text: 'p-tieredmenu-item-label',
submenuIcon: 'p-tieredmenu-submenu-icon', submenuIcon: 'p-tieredmenu-submenu-icon',
submenu: 'p-tieredmenu-submenu-list', submenu: 'p-tieredmenu-submenu-list',
separator: 'p-tieredmenu-separator', separator: 'p-tieredmenu-separator',