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

feat: match dropdown-item component to related plugin #49

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 29 additions & 5 deletions components/base/BaseDropdownItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ const props = withDefaults(
*/
disabled?: boolean

/**
* The shape of the dropdown-item.
*/
shape?: 'straight' | 'rounded' | 'smooth' | 'curved'

/**
* The color of the dropdown-item.
*/
color?: 'default' | 'contrast'

/**
* The value for the `rel` attribute on the button.
*/
Expand Down Expand Up @@ -57,6 +67,8 @@ const props = withDefaults(
target: undefined,
title: undefined,
text: undefined,
shape: undefined,
color: 'default',
disabled: false,
classes: () => ({
title:
Expand All @@ -65,6 +77,18 @@ const props = withDefaults(
}),
}
)

const shapeStyle = {
straight: '',
rounded: 'nui-item-rounded',
smooth: 'nui-item-smooth',
curved: 'nui-item-curved',
}
const colorStyle = {
default: 'nui-item-default',
contrast: 'nui-item-contrast',
}

const { is, attributes } = useNinjaButton(props)
</script>

Expand All @@ -76,16 +100,16 @@ const { is, attributes } = useNinjaButton(props)
<component
:is="is"
v-bind="attributes"
class="group/nui-dropdown-item flex w-full items-center justify-start rounded-md px-3 py-2 text-left text-sm transition-colors duration-300"
class="nui-dropdown-item"
:class="[
active
? 'bg-muted-100 dark:bg-muted-700 text-primary-500'
: 'text-muted-500',
active && 'nui-active',
props.shape && shapeStyle[props.shape],
colorStyle[props.color],
]"
@click.passive="close"
>
<slot name="start"></slot>
<div class="grow">
<div class="nui-item-content">
<div :class="props.classes.title">
<slot>{{ props.title }}</slot>
</div>
Expand Down
5 changes: 1 addition & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { createResolver } from '@nuxt/kit'

// import { withShurikenUI } from '@shuriken-ui/tailwind'
import { withShurikenUI } from '../tailwind/src'
import { withShurikenUI } from '@shuriken-ui/tailwind'

const { resolve } = createResolver(import.meta.url)

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: [
'@vueuse/nuxt',
Expand Down