Tokens for Menu

pull/5756/head
Cagatay Civici 2024-05-10 10:23:39 +03:00
parent e26558ba67
commit 16dd3dc746
5 changed files with 90 additions and 44 deletions

View File

@ -2,11 +2,11 @@ import BaseStyle from 'primevue/base/style';
const theme = ({ dt }) => `
.p-menu {
padding: 0.25rem 0.25rem;
padding: ${dt('menu.padding')};
background: ${dt('menu.background')};
color: ${dt('menu.color')};
border: 1px solid ${dt('menu.border.color')};
border-radius: ${dt('border.radius.md')};
border-radius: ${dt('menu.border.radius')};
min-width: 12.5rem;
}
@ -15,18 +15,9 @@ const theme = ({ dt }) => `
padding: 0;
outline: 0;
list-style: none;
}
.p-menu-item {
margin: 2px 0;
}
.p-menu-item:first-child {
margin-top: 0;
}
.p-menu-item:last-child {
margin-bottom: 0;
display: flex;
flex-direction: column;
gap: ${dt('menu.gap')};
}
.p-menu-item-link {
@ -37,13 +28,14 @@ const theme = ({ dt }) => `
overflow: hidden;
position: relative;
color: inherit;
padding: 0.5rem 0.75rem;
padding: ${dt('menu.item.padding')};
user-select: none;
gap: ${dt('menu.item.gap')};
}
.p-menu-item-content {
transition: background-color ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('border.radius.sm')};
transition: background ${dt('transition.duration')}, color ${dt('transition.duration')};
border-radius: ${dt('menu.item.border.radius')};
color: ${dt('menu.item.color')};
}
@ -53,7 +45,6 @@ const theme = ({ dt }) => `
.p-menu-item-icon {
color: ${dt('menu.item.icon.color')};
margin-right: 0.5rem;
}
.p-menu-item.p-focus .p-menu-item-content {
@ -62,7 +53,7 @@ const theme = ({ dt }) => `
}
.p-menu-item.p-focus .p-menu-item-icon {
color: ${dt('menu.item.icon.hover.color')};
color: ${dt('menu.item.icon.focus.color')};
}
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover {
@ -71,23 +62,22 @@ const theme = ({ dt }) => `
}
.p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {
color: ${dt('menu.item.icon.hover.color')};
color: ${dt('menu.item.icon.focus.color')};
}
.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: ${dt('menu.shadow')};
}
.p-menu-submenu-item {
margin: 0;
padding: 0.5rem 0.75rem;
color: ${dt('menu.submenu.item.color')};
font-weight: 600;
background: ${dt('menu.submenu.label.background')};
padding: ${dt('menu.submenu.label.padding')};
color: ${dt('menu.submenu.label.color')};
font-weight: ${dt('menu.submenu.label.font.weight')};
}
.p-menu-separator {
border-top: 1px solid ${dt('menu.separator.border.color.color')};
margin: 2px 0;
border-top: 1px solid ${dt('menu.separator.border.color')};
}
`;

View File

@ -161,7 +161,7 @@ export default {
},
option: {
padding: '0.5rem 0.75rem',
borderRadius: '4px'
borderRadius: '{border.radius.sm}'
},
optionGroup: {
padding: '0.5rem 0.75rem',
@ -171,6 +171,19 @@ export default {
content: {
borderRadius: '{border.radius.md}'
},
navigation: {
padding: '0.25rem 0.25rem',
gap: '2px',
item: {
padding: '0.5rem 0.75rem',
borderRadius: '{border.radius.sm}',
gap: '0.5rem'
},
submenuLabel: {
padding: '0.5rem 0.75rem',
fontWeight: '600'
}
},
overlay: {
select: {
borderRadius: '{border.radius.md}',
@ -185,6 +198,9 @@ export default {
borderRadius: '{border.radius.xl}',
padding: '1.25rem',
shadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)'
},
navigation: {
shadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)'
}
},
colorScheme: {
@ -293,8 +309,9 @@ export default {
focusColor: '{surface.500}'
}
},
submenu: {
color: '{surface.400}'
submenuLabel: {
background: '{surface.0}',
color: '{text.muted.color}'
}
}
},
@ -403,8 +420,9 @@ export default {
focusColor: '{surface.400}'
}
},
submenu: {
color: '{surface.500}'
submenuLabel: {
background: '{surface.900}',
color: '{text.muted.color}'
}
}
}

View File

@ -2,19 +2,29 @@ export default {
root: {
background: '{content.background}',
borderColor: '{content.border.color}',
color: '{content.color}'
color: '{content.color}',
padding: '{navigation.padding}',
borderRadius: '{content.border.radius}',
gap: '{navigation.gap}',
shadow: '{overlay.navigation.shadow}'
},
item: {
focusBackground: '{navigation.item.focus.background}',
color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}',
padding: '{navigation.item.padding}',
borderRadius: '{navigation.item.border.radius}',
gap: '{navigation.item.gap}',
icon: {
color: '{navigation.item.icon.color}',
hoverColor: '{navigation.item.icon.hover.color}'
focusColor: '{navigation.item.icon.focus.color}'
}
},
submenuItem: {
color: '{navigation.submenu.color}'
submenuLabel: {
padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}',
bakcground: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}'
},
separator: {
borderColor: '{content.border.color}'

View File

@ -170,6 +170,19 @@ export default {
content: {
borderRadius: '{border.radius.sm}'
},
navigation: {
padding: '0.5rem 0',
gap: '0',
item: {
padding: '0.625rem 1rem',
borderRadius: '0',
gap: '0.5rem'
},
submenuLabel: {
padding: '0.625rem 1rem',
fontWeight: '600'
}
},
overlay: {
select: {
borderRadius: '{border.radius.sm}',
@ -184,6 +197,9 @@ export default {
borderRadius: '{border.radius.lg}',
padding: '1.5rem',
shadow: '0 1px 3px rgba(0, 0, 0, 0.3)'
},
navigation: {
shadow: '0 2px 12px 0 rgba(0, 0, 0, 0.1)'
}
},
colorScheme: {
@ -295,8 +311,9 @@ export default {
focusColor: '{surface.500}'
}
},
submenu: {
color: '{surface.400}'
submenuLabel: {
background: '{surface.0}',
color: '{text.color}'
}
}
},
@ -408,8 +425,9 @@ export default {
focusColor: '{surface.400}'
}
},
submenu: {
color: '{surface.500}'
submenuLabel: {
background: '{surface.900}',
color: '{text.color}'
}
}
}

View File

@ -2,19 +2,29 @@ export default {
root: {
background: '{content.background}',
borderColor: '{content.border.color}',
color: '{content.color}'
color: '{content.color}',
padding: '{navigation.padding}',
borderRadius: '{content.border.radius}',
gap: '{navigation.gap}',
shadow: '{overlay.navigation.shadow}'
},
item: {
focusBackground: '{navigation.item.focus.background}',
color: '{navigation.item.color}',
focusColor: '{navigation.item.focus.color}',
padding: '{navigation.item.padding}',
borderRadius: '{navigation.item.border.radius}',
gap: '{navigation.item.gap}',
icon: {
color: '{navigation.item.icon.color}',
hoverColor: '{navigation.item.icon.hover.color}'
focusColor: '{navigation.item.icon.focus.color}'
}
},
submenuItem: {
color: '{navigation.submenu.color}'
submenuLabel: {
padding: '{navigation.submenu.label.padding}',
fontWeight: '{navigation.submenu.label.font.weight}',
bakcground: '{navigation.submenu.label.background.}',
color: '{navigation.submenu.label.color}'
},
separator: {
borderColor: '{content.border.color}'