Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#9890 Update the design for the focused item state in SideMenu #408

Merged
merged 16 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
54dc8a0
pkp/pkp-lib#9890 Define outline config in tailwind
blesildaramirez Sep 3, 2024
b222edb
pkp/pkp-lib#9890 Map index in items data for sidemenu component
blesildaramirez Sep 3, 2024
a3b3742
pkp/pkp-lib#9890 Define border and outline classes for SideMenu compo…
blesildaramirez Sep 3, 2024
f2528d5
pkp/pkp-lib#9890 Update menu items mapping in sidenav for sidemenu
blesildaramirez Sep 3, 2024
0fdbaee
pkp/pkp-lib#9890 Update links to sidemenu stories
blesildaramirez Sep 3, 2024
3250739
pkp/pkp-lib#9890 Add command on root items to navigate to links
blesildaramirez Sep 3, 2024
3686a17
pkp/pkp-lib#9890 Add new colorVariant 'attention' to Badge component
blesildaramirez Sep 11, 2024
de59e08
pkp/pkp-lib#9890 Remove added outlineColor in tailwind config
blesildaramirez Sep 11, 2024
7133bc0
pkp/pkp-lib#9890 Change background color when an item is infocus in s…
blesildaramirez Sep 11, 2024
7531321
pkp/pkp-lib#9890 Add onActionFn parameter in useSideMenu api and map …
blesildaramirez Sep 11, 2024
c507867
pkp/pkp-lib#9890 Add link color override in DropdownActions component
blesildaramirez Sep 11, 2024
5b450e9
pkp/pkp-lib#9890 Add comment on setting the css property for itemlink…
blesildaramirez Sep 11, 2024
41b929d
pkp/pkp-lib#9890 Use SideNav component in Page story
blesildaramirez Sep 11, 2024
4651801
pkp/pkp-lib#9890 Remove app__nav css in Page container vue
blesildaramirez Sep 11, 2024
475214d
pkp/pkp-lib#9890 Wrap item label in a span - SideMenu component
blesildaramirez Sep 12, 2024
5ee2c9a
pkp/pkp-lib#9890 Update items when links get updated in SideNav compo…
blesildaramirez Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/Badge/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default {
'negative-bg',
'stage-in-review-bg',
'success-bg',
'attention',
].includes(prop),
},
/** */
Expand All @@ -74,13 +75,17 @@ export default {
const colorVariant = this.colorVariant;
return {
// base
'inline-block py-1 px-4 text-base-normal rounded-[1.2em] border': true,
'inline-block py-1 px-3 text-base-normal rounded-[1.2em] border': true,
// default
'text-default border-light': colorVariant === 'default',
// default-on-dark
'text-on-dark border-light': colorVariant === 'default-on-dark',
// primary
'border-primary text-primary': colorVariant === 'primary',
'border-primary text-primary bg-secondary':
colorVariant === 'primary',
// attention-border
'border-attention text-attention bg-secondary':
colorVariant === 'attention',
// primary-bg
'bg-primary text-on-dark border-primary':
colorVariant === 'primary-bg',
Expand Down
49 changes: 4 additions & 45 deletions src/components/Container/Page.stories.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {computed} from 'vue';
import Page from './Page.vue';
import Dropdown from '@/components/Dropdown/Dropdown.vue';
import SideNav from '@/components/SideNav/SideNav.vue';
import PageMock from '@/mocks/page';

export default {
Expand All @@ -10,7 +11,7 @@ export default {

export const Default = {
render: (args) => ({
components: {Page, Dropdown},
components: {Page, Dropdown, SideNav},
setup() {
const classes = computed(() => {
let _classes = [];
Expand Down Expand Up @@ -108,50 +109,8 @@ export const Default = {
</header>

<div class="app__body">
<nav
v-if="!!menu && Object.keys(menu).length > 1"
class="app__nav"
aria-label="Site Navigation"
>
<ul>
<li
v-for="(menuItem, key) in menu"
:key="key"
:class="!!menuItem.submenu ? 'app__navGroup' : ''"
>
<div
v-if="!!menuItem.submenu"
class="app__navItem app__navItem--hasSubmenu"
>
{{ menuItem.name }}
</div>
<a
v-else
class="app__navItem"
:class="menuItem.isCurrent ? 'app__navItem--isCurrent' : ''"
:href="menuItem.url"
>
{{ menuItem.name }}
</a>
<ul v-if="!!menuItem.submenu">
<li
v-for="(submenuItem, submenuKey) in menuItem.submenu"
:key="submenuKey"
>
<a
class="app__navItem"
:class="
submenuItem.isCurrent ? 'app__navItem--isCurrent' : ''
"
:href="submenuItem.url"
>
{{ submenuItem.name }}
</a>
</li>
</ul>
</li>
</ul>
</nav>
<SideNav :links="menu" aria-label="Site Navigation">
</SideNav>
<main class="app__main">
<div class="app__page">
<nav
Expand Down
67 changes: 0 additions & 67 deletions src/components/Container/Page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -371,73 +371,6 @@ export default {
align-items: stretch;
}

.app__nav {
flex: 0 0 15rem;
padding-top: 1.5rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
font-size: @font-sml;
line-height: 1.5rem;

ul {
margin: 0;
padding: 0;
list-style: none;
}
}

.app__navGroup {
margin-top: 2rem;
margin-bottom: 2rem;
}

.app__navItem {
display: inline-block;
padding: 0.25rem 0.5rem;
color: @bg-anchor;

.app__navItem {
padding-left: 0;
padding-right: 0;
}
}

.app__navItem--hasSubmenu {
font-weight: @bold;
}

a.app__navItem {
text-decoration: none;

&:hover {
color: @primary;
}

&:focus {
box-shadow: 0 0 0 1px @primary;
border-radius: @radius;
outline: 0;
color: @bg-anchor;
}
}

a.app__navItem--isCurrent {
background: @bg-anchor;
border-radius: @radius;
font-weight: bold;
color: #fff;

&:hover {
color: #fff;
}

&:focus {
box-shadow: none;
background: @primary;
color: #fff;
}
}

.app__main {
padding: 1rem;
width: 100%;
Expand Down
11 changes: 11 additions & 0 deletions src/components/DropdownActions/DropdownActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,14 @@ const isValidAction = (action) => {
return action?.label && (action?.url || action?.name);
};
</script>

<style lang="less" scoped>
@import '../../styles/_import';

/* Override legacy styles for: a:hover, a:focus, where the color is being set to #008acb */
a.text-on-dark:hover,
a.text-on-dark:focus,
a.text-on-dark:active {
color: rgb(255 255 255 / var(--tw-text-opacity));
}
</style>
7 changes: 3 additions & 4 deletions src/components/Modal/SideModal.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,9 @@ const SideModalWithSideMenu = {
},
];

const {sideMenuProps, setExpandedKeys} = useSideMenu(
items,
'review_round_1',
);
const {sideMenuProps, setExpandedKeys} = useSideMenu(items, {
activeItemKey: 'review_round_1',
});
setExpandedKeys(['workflow', 'review', 'publication']);

return {metadata, generalInformation, items, sideMenuProps};
Expand Down
Loading