Skip to content

Commit

Permalink
playground stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
YannicEl committed Feb 25, 2024
1 parent 2c36d0a commit ebdd61d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"preview": "vite preview"
},
"dependencies": {
"@unocss/reset": "0.58.5",
"@vuetils/form": "0.2.7",
"@vuetils/toast": "workspace:^",
"vue": "3.4.19"
Expand Down
30 changes: 22 additions & 8 deletions packages/playground/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
<template>
<div class="flex flex h-screen w-screen flex-col items-center justify-center">
<button @click="addToast">Press me</button>
<button class="rounded-md border border-black px-2 py-1 shadow-xl" @click="onClick">
Press me
</button>

<div class="mt-4 grid grid-cols-3 gap-4">
<label v-for="value in positions">
{{ value }}
<UInput :field="position" type="radio" name="radio" :value="value" />
<UInput :field="position" type="radio" name="position" :value="value" />
</label>
</div>

<div class="mt-4 grid grid-cols-3 gap-4">
<label v-for="value in types">
{{ value }}
<UInput :field="type" type="radio" name="type" :value="value" />
</label>
</div>
</div>

<Toaster :toast="CustomToast" :position="position.value" />
<Toaster :toast="ToastComponent" :position="position.value" />
</template>

<script setup lang="ts">
import { UInput, useField } from '@vuetils/form';
import type { ToastPosition } from '@vuetils/toast';
import { Toaster, toast } from '@vuetils/toast';
import CustomToast from './components/CustomToast.vue';
import type { ToastPosition, ToastType } from '@vuetils/toast';
import { ToastComponent, Toaster, addToast } from '@vuetils/toast';
const positions: ToastPosition[] = [
'top-left',
Expand All @@ -28,10 +36,16 @@ const positions: ToastPosition[] = [
'bottom-right',
];
const types: ToastType[] = ['success', 'error', 'loading'];
const position = useField<ToastPosition>('bottom-center');
const type = useField<ToastType>('success');
function addToast() {
toast.success(Date.now() + '', { autoClose: false });
function onClick() {
addToast(Date.now() + '', {
type: type.value,
autoClose: false,
});
}
</script>

Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@unocss/reset/tailwind.css';
import '@vuetils/toast/style.css';
import 'virtual:uno.css';
import { createApp } from 'vue';
Expand Down
6 changes: 4 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ebdd61d

Please sign in to comment.