From 16dd3dc7469801d8d7e395c701dd35ad7792978c Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Fri, 10 May 2024 10:23:39 +0300 Subject: [PATCH] Tokens for Menu --- components/lib/menu/style/MenuStyle.js | 44 +++++++++--------------- components/lib/themes/aura/index.js | 28 ++++++++++++--- components/lib/themes/aura/menu/index.js | 18 +++++++--- components/lib/themes/lara/index.js | 26 +++++++++++--- components/lib/themes/lara/menu/index.js | 18 +++++++--- 5 files changed, 90 insertions(+), 44 deletions(-) diff --git a/components/lib/menu/style/MenuStyle.js b/components/lib/menu/style/MenuStyle.js index 03f7e2613..39faf6bbe 100644 --- a/components/lib/menu/style/MenuStyle.js +++ b/components/lib/menu/style/MenuStyle.js @@ -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')}; } `; diff --git a/components/lib/themes/aura/index.js b/components/lib/themes/aura/index.js index 21164c728..78d1a04ba 100644 --- a/components/lib/themes/aura/index.js +++ b/components/lib/themes/aura/index.js @@ -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}' } } } diff --git a/components/lib/themes/aura/menu/index.js b/components/lib/themes/aura/menu/index.js index e0539fecb..d2c5bdbf4 100644 --- a/components/lib/themes/aura/menu/index.js +++ b/components/lib/themes/aura/menu/index.js @@ -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}' diff --git a/components/lib/themes/lara/index.js b/components/lib/themes/lara/index.js index 431b84b74..459dffd3d 100644 --- a/components/lib/themes/lara/index.js +++ b/components/lib/themes/lara/index.js @@ -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}' } } } diff --git a/components/lib/themes/lara/menu/index.js b/components/lib/themes/lara/menu/index.js index e0539fecb..d2c5bdbf4 100644 --- a/components/lib/themes/lara/menu/index.js +++ b/components/lib/themes/lara/menu/index.js @@ -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}'