Skip to content

Commit

Permalink
Merge branch 'main' into download-reviews-from-modal
Browse files Browse the repository at this point in the history
  • Loading branch information
MrRob100 committed Oct 3, 2024
2 parents de2af3e + 3ef7800 commit 05f2999
Show file tree
Hide file tree
Showing 133 changed files with 8,748 additions and 2,717 deletions.
316 changes: 238 additions & 78 deletions public/globals.js

Large diffs are not rendered by default.

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
19 changes: 19 additions & 0 deletions src/components/ButtonIcon/ButtonIcon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {Primary, Controls, Stories, Meta, Description} from '@storybook/blocks';

import * as ButtonIconStories from './ButtonIcon.stories.js';

<Meta of={ButtonIconStories} />

# ButtonIcon

## Usage

Use the ButtonIcon component to create a button that displays only an icon, without any visible text.

## Accessibility

Since the button has no visible text, use a descriptive aria-label to ensure it's accessible to screen reader users.

<Primary />
<Controls />
<Stories />
61 changes: 61 additions & 0 deletions src/components/ButtonIcon/ButtonIcon.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import ButtonIcon from './ButtonIcon.vue';
export default {
title: 'Components/ButtonIcon',
component: ButtonIcon,
render: (args) => ({
components: {ButtonIcon},
setup() {
return {args};
},
template: '<ButtonIcon v-bind="args" />',
}),
};

export const Default = {
args: {
icon: 'Add',
ariaLabel: 'Add more items',
},
};

export const Disabled = {
args: {
icon: 'Cancel',
ariaLabel: 'Cancel',
isDisabled: true,
},
};

export const Active = {
args: {
icon: 'Complete',
ariaLabel: 'Complete',
isActive: true,
},
};

export const Order = {
render: (args) => ({
components: {ButtonIcon},
setup() {
return {args};
},
template: `
<div class="flex inline-flex items-center items-justify gap-2">
<ButtonIcon v-for="icon in args.icons" v-bind="icon" />
</div>
`,
}),
args: {
icons: [
{
icon: 'ChevronUp',
ariaLabel: 'Move up',
},
{
icon: 'ChevronDown',
ariaLabel: 'Move down',
},
],
},
};
47 changes: 47 additions & 0 deletions src/components/ButtonIcon/ButtonIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<button :class="styles" :aria-label="ariaLabel" :disabled="isDisabled">
<Icon class="h-6 w-6" :icon="icon" aria-hidden="true" />
</button>
</template>

<script setup>
import {computed} from 'vue';
import Icon from '@/components/Icon/Icon.vue';
const props = defineProps({
/** Icon name to be displayed within the button */
icon: {
type: String,
required: true,
},
/** Accessible label for the button. */
ariaLabel: {
type: String,
default: null,
},
/** Indicates whether the button is in an active state. */
isActive: {
type: Boolean,
default: false,
},
/** Disables the button, making it unclickable and styled as disabled */
isDisabled: {
type: Boolean,
default: false,
},
});
const styles = computed(() => ({
// Base
'inline-flex relative items-center justify-center text-lg-semibold rounded w-6 h-6': true,
// Default
'text-primary': !props.isActive,
// Hover
'hover:text-on-dark hover:bg-hover': !props.isDisabled,
// Active
'text-on-dark bg-selection-dark border-transparent': props.isActive,
// Disabled
'hover:text-disabled hover:bg-secondary !text-disabled cursor-not-allowed':
props.isDisabled,
}));
</script>
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
32 changes: 32 additions & 0 deletions src/components/Container/WorkflowPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import PkpHeader from '@/components/Header/Header.vue';
import LocalizeSubmission from '@/mixins/localizeSubmission.js';
import ajaxError from '@/mixins/ajaxError';
import dialog from '@/mixins/dialog.js';
import ChangeSubmissionLanguage from '@/pages/workflow/ChangeSubmissionLanguage.vue';
import SelectRevisionDecisionModal from '@/pages/workflow/SelectRevisionDecisionModal.vue';
import {useModal} from '@/composables/useModal';
export default {
name: 'WorkflowPage',
components: {
ChangeSubmissionLanguage,
ContributorsListPanel,
Composer,
Dropdown,
Expand All @@ -28,6 +30,8 @@ export default {
return {
activityLogLabel: '',
canAccessPublication: false,
canChangeSubmissionLanguage: false,
currentSubmissionLanguageLabel: '',
canEditPublication: false,
currentPublication: null,
decisionUrl: '',
Expand Down Expand Up @@ -311,6 +315,20 @@ export default {
).pkpHandler('$.pkp.controllers.modal.AjaxModalHandler', opts);
},
/**
* Open a modal displaying the change submission language form
*/
openChangeSubmissionLanguageModal() {
const {openSideModal} = useModal();
openSideModal(ChangeSubmissionLanguage, {
form: this.components[
pkp.const.FORM_CHANGE_SUBMISSION_LANGUAGE_METADATA
],
publicationId: this.workingPublication.id,
submissionId: this.submission.id,
});
},
/**
* Open a modal to prompt the user to confirm creation of
* a new version
Expand Down Expand Up @@ -734,6 +752,20 @@ export default {
}
}
.pkpSubmission__localeNotSupported {
margin: 0 -2rem;
padding: 1rem;
background: @primary;
font-size: @font-sml;
color: #fff;
text-align: center;
}
.pkpPublication__changeSubmissionLanguage {
display: block;
padding-bottom: 0.25rem;
}
// Integrate the grids in the publication tab
.pkpWorkflow__contributors,
#representations-grid {
Expand Down
10 changes: 10 additions & 0 deletions src/components/Dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<slot name="button">
<Icon v-if="icon" :icon="icon" :inline="true" />
{{ label }}
<Icon
v-if="hasDropdownIcon"
class="-mr-1 h-5 w-5 text-primary"
icon="Dropdown"
aria-hidden="true"
/>
</slot>
</PkpButton>
<div
Expand Down Expand Up @@ -72,6 +78,10 @@ export default {
type: Boolean,
default: false,
},
hasDropdownIcon: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand Down
Loading

0 comments on commit 05f2999

Please sign in to comment.