Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #140 from selemondev/fix-notification-transition
Browse files Browse the repository at this point in the history
fix: notification transition
  • Loading branch information
selemondev authored Sep 13, 2023
2 parents 41c8dbb + dc3708b commit 9961d68
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/nuxt-ui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-ui-vue",
"version": "1.0.1-beta.1",
"version": "1.0.1-beta.2",
"private": false,
"exports": {
".": {
Expand Down
9 changes: 8 additions & 1 deletion packages/nuxt-ui-vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<script setup lang="ts">
import { injectToast } from './composables/useToast'
import Hello from './components/Hello.vue'
injectToast()
</script>

<template>
<div />
<div class="grid place-items-center w-full min-h-screen">
<Hello />
<UNotifications />
</div>
</template>
13 changes: 13 additions & 0 deletions packages/nuxt-ui-vue/src/components/Hello.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { useToast } from '@/composables/useToast'
const toast = useToast()
</script>

<template>
<UButton
label="Show toast" @click="toast.add({
title: 'Update downloaded.',
})"
/>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ onUnmounted(() => {
const attrsOmitted = omit(attrs, ['class'])
const notificationTransitions = {
enter: variant.value.transitionEnterActiveClass,
enterFrom: variant.value.transitionEnterFromClass,
enterTo: variant.value.transitionEnterToClass,
leave: variant.value.transitionLeaveActiveClass,
leaveFrom: variant.value.transitionLeaveFromClass,
leaveTo: variant.value.transitionLeaveToClass,
enterActiveClass: variant.value.transitionEnterActiveClass,
enterFromClass: variant.value.transitionEnterFromClass,
enterToClass: variant.value.transitionEnterToClass,
leaveActiveClass: variant.value.transitionLeaveActiveClass,
leaveFromClass: variant.value.transitionLeaveFromClass,
leaveToClass: variant.value.transitionLeaveToClass,
}
</script>

Expand All @@ -176,6 +176,7 @@ export default defineComponent({
</script>

<template>
<!-- @vue-ignore -->
<Transition appear v-bind="notificationTransitions">
<div :class="wrapperClass" v-bind="attrsOmitted" @mouseover="onMouseover" @mouseleave="onMouseleave">
<div :class="[variant.container, variant.rounded, variant.ring]">
Expand Down
33 changes: 33 additions & 0 deletions packages/nuxt-ui-vue/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
/* eslint-disable no-unused-expressions */
import tailwindColors from './node_modules/tailwindcss/colors'

const colorSafeList = []

const deprecated = ['lightBlue', 'warmGray', 'trueGray', 'coolGray', 'blueGray']

for (const colorName in tailwindColors) {
if (deprecated.includes(colorName))
continue

const shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]

const pallette = tailwindColors[colorName]

if (typeof pallette === 'object') {
shades.forEach((shade) => {
if (shade in pallette) {
colorSafeList.push(`text-${colorName}-${shade}`),
colorSafeList.push(`accent-${colorName}-${shade}`),
colorSafeList.push(`bg-${colorName}-${shade}`),
colorSafeList.push(`hover:enabled:bg-${colorName}-${shade}`),
colorSafeList.push(`focus:bg-${colorName}-${shade}`),
colorSafeList.push(`ring-${colorName}-${shade}`),
colorSafeList.push(`focus:ring-${colorName}-${shade}`),
colorSafeList.push(`border-${colorName}-${shade}`)
}
})
}
}

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
darkMode: 'class',
safelist: colorSafeList,
theme: {
extend: {
colors: tailwindColors,
backgroundColor: ['disabled'],
textColor: ['disabled'],
fontFamily: {
Expand Down

0 comments on commit 9961d68

Please sign in to comment.