Skip to content

Commit

Permalink
pkp/pkp-lib#10994 ShowMore button (pkp#539)
Browse files Browse the repository at this point in the history
* pkp/pkp-lib#10994 ShowMore button
  • Loading branch information
jardakotesovec authored Feb 27, 2025
1 parent 8c32c7c commit 03bf8ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/components/Button/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
:class="styles"
:href="element === 'a' ? href : false"
:disabled="element === 'a' && !isDisabled ? undefined : isDisabled"
@click="click"
@focus="emit('focus')"
@blur="emit('blur')"
>
Expand Down Expand Up @@ -61,12 +60,6 @@ const isSecondary = computed(
!props.isActive),
);
function click(e) {
if (props.element === 'button') {
e.preventDefault();
}
}
const styles = computed(() => ({
// Base
'inline-flex relative items-center gap-x-1 ': true,
Expand Down
16 changes: 16 additions & 0 deletions src/components/ShowMore/ShowMore.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ShowMore from './ShowMore.vue';

export default {title: 'Components/ShowMore', component: ShowMore};

export const Primary = {
render: (args) => ({
components: {ShowMore},
setup() {
return {args};
},
template: '<ShowMore v-bind="args">Hello</ShowMore>',
}),
args: {
label: 'Show more details',
},
};
19 changes: 19 additions & 0 deletions src/components/ShowMore/ShowMore.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<Disclosure>
<DisclosureButton v-slot="{open}" as="template" class="">
<Button is-active :icon="open ? 'Dropup' : 'Dropdown'">
{{ label }}
</Button>
</DisclosureButton>
<DisclosurePanel class="">
<slot />
</DisclosurePanel>
</Disclosure>
</template>

<script setup>
import {Disclosure, DisclosureButton, DisclosurePanel} from '@headlessui/vue';
import Button from '../Button/Button.vue';
defineProps({label: {type: String, required: true}});
</script>

0 comments on commit 03bf8ac

Please sign in to comment.