Skip to content

Commit

Permalink
feat(BaseFullscreenDropfile): add color prop
Browse files Browse the repository at this point in the history
  • Loading branch information
driss-chelouati committed Feb 22, 2024
1 parent 0f0e4cc commit ec8ed33
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export default defineAppConfig({
rounded: 'sm',
color: 'default',
},
BaseFullscreenDropfile: {
color: 'primary',
},
BaseHeading: {
as: 'p',
size: 'xl',
Expand Down
19 changes: 18 additions & 1 deletion components/form/BaseFullscreenDropfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ const props = withDefaults(
*/
icon?: string
/**
* Defines the color of the icon
*
* @since 3.0.0
* @default 'default'
*/
color?: 'primary' | 'dark' | 'black'
/**
* Allows to filter files when dropped.
*/
Expand All @@ -19,6 +27,7 @@ const props = withDefaults(
{
label: 'Drop your files',
icon: '',
color: undefined,
filterFileDropped: () => true,
},
)
Expand Down Expand Up @@ -82,10 +91,18 @@ onBeforeUnmount(() => {
document.documentElement.removeEventListener('dragover', onDragover)
document.documentElement.removeEventListener('drop', onDrop)
})
const colors = {
primary: 'nui-dropfile-primary',
dark: 'nui-dropfile-dark',
black: 'nui-dropfile-black',
}
const color = useNuiDefaultProperty(props, 'BaseFullscreenDropfile', 'color')
</script>

<template>
<div class="nui-fullscreen-dropfile">
<div class="nui-fullscreen-dropfile" :class="color && colors[color]">
<div v-if="isDropping" class="nui-fullscreen-dropfile-outer" />
<div v-show="isDropping" class="nui-fullscreen-dropfile-inner">
<Transition
Expand Down
8 changes: 8 additions & 0 deletions nuxt.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ export default defineNuxtSchema({
*/
color: 'default',
},
BaseFullscreenDropfile: {
/**
* The color of the icon.
*
* @type {'primary' | 'dark' | 'black'}
*/
color: 'primary',
},
BaseHeading: {
/**
* The tag of the heading.
Expand Down

0 comments on commit ec8ed33

Please sign in to comment.