Skip to content

Commit

Permalink
feat(dropdown): allow disabling menu options (#306) (#307)
Browse files Browse the repository at this point in the history
close #306
  • Loading branch information
brc-dd committed Jun 19, 2023
1 parent 00b2e45 commit cbfa10d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/components/SDropdownSectionMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ defineProps<{
<template>
<ul class="SDropdownSectionMenu">
<li v-for="option in options" :key="option.label" class="item">
<button class="button" @click="option.onClick">
<button
class="button"
@click="option.onClick"
:disabled="option.disabled"
>
{{ option.label }}
</button>
</li>
Expand All @@ -33,8 +37,13 @@ defineProps<{
font-weight: 400;
transition: color 0.25s, background-color 0.25s;
&:hover {
&:hover:not(:disabled) {
background-color: var(--c-mute);
}
&:disabled {
color: var(--c-text-3);
cursor: not-allowed;
}
}
</style>
1 change: 1 addition & 0 deletions lib/composables/Dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface DropdownSectionMenu extends DropdownSectionBase {

export interface DropdownSectionMenuOption {
label: string
disabled?: boolean
onClick(): void
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@globalbrain/sefirot",
"version": "2.37.1",
"packageManager": "pnpm@8.5.0",
"packageManager": "pnpm@8.6.2",
"description": "Vue Components for Global Brain Design System.",
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
"license": "MIT",
Expand Down

0 comments on commit cbfa10d

Please sign in to comment.