mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-21 15:31:46 +01:00
chore: update
This commit is contained in:
@@ -48,6 +48,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</UContainer>
|
||||
|
||||
<ClientOnly>
|
||||
<UNotifications />
|
||||
</ClientOnly>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -56,7 +60,7 @@ import { UseDark } from '@vueuse/components'
|
||||
|
||||
const sections = [
|
||||
{ label: 'Getting Started', links: [{ label: 'Usage', to: '/' }, { label: 'Examples', to: '/examples' }, { label: 'Migration', to: '/migration' }, { label: 'Dark mode', to: '/dark' }] },
|
||||
{ label: 'Elements', links: [{ label: 'Avatar', to: '/components/Avatar' }, { label: 'AvatarGroup', to: '/components/AvatarGroup' }, { label: 'Badge', to: '/components/Badge' }, { label: 'Button', to: '/components/Button' }, { label: 'Dropdown', to: '/components/Dropdown' }, { label: 'Icon', to: '/components/Icon' }, { label: 'Link', to: '/components/Link' }] },
|
||||
{ label: 'Elements', links: [{ label: 'Avatar', to: '/components/Avatar' }, { label: 'AvatarGroup', to: '/components/AvatarGroup' }, { label: 'Badge', to: '/components/Badge' }, { label: 'Button', to: '/components/Button' }, { label: 'Dropdown', to: '/components/Dropdown' }, { label: 'Icon', to: '/components/Icon' }] },
|
||||
{ label: 'Feedback', links: [{ label: 'Alert', to: '/components/Alert' }] },
|
||||
{ label: 'Forms', links: [{ label: 'Checkbox', to: '/components/Checkbox' }, { label: 'Input', to: '/components/Input' }, { label: 'InputGroup', to: '/components/InputGroup' }, { label: 'Radio', to: '/components/Radio' }, { label: 'RadioGroup', to: '/components/RadioGroup' }, { label: 'Select', to: '/components/Select' }, { label: 'SelectCustom', to: '/components/SelectCustom' }, { label: 'Textarea', to: '/components/Textarea' }, { label: 'Toggle', to: '/components/Toggle' }, { label: 'ToggleGroup', to: '/components/ToggleGroup' }] },
|
||||
{ label: 'Layout', links: [{ label: 'Card', to: '/components/Card' }, { label: 'Container', to: '/components/Container' }] },
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<template>
|
||||
<UCard v-if="component" class="relative flex flex-col lg:max-h-[calc(100vh-10rem)]" body-class="px-4 py-5 sm:p-6 relative" footer-class="px-4 py-4 sm:px-6 flex-1 lg:overflow-y-auto">
|
||||
<div class="flex justify-center">
|
||||
<component :is="is" v-bind="boundProps" />
|
||||
<component :is="is" v-bind="boundProps">
|
||||
<template v-if="defaultProps[params.component].slot" #default>
|
||||
<component :is="`U${defaultProps[params.component].slot}`" v-bind="defaultProps[defaultProps[params.component].slot]" />
|
||||
</template>
|
||||
</component>
|
||||
</div>
|
||||
|
||||
<template v-if="props.length" #footer>
|
||||
@@ -108,11 +112,13 @@ const defaultProps = {
|
||||
name: 'heroicons-outline:bell'
|
||||
},
|
||||
Input: {
|
||||
name: 'input'
|
||||
name: 'input',
|
||||
placeholder: 'Enter text'
|
||||
},
|
||||
InputGroup: {
|
||||
name: 'input',
|
||||
label: 'Input group'
|
||||
label: 'Input group',
|
||||
slot: 'Input'
|
||||
},
|
||||
ToggleGroup: {
|
||||
name: 'input',
|
||||
@@ -133,6 +139,11 @@ const defaultProps = {
|
||||
},
|
||||
Tooltip: {
|
||||
text: 'Tooltip text'
|
||||
},
|
||||
Notification: {
|
||||
id: '1',
|
||||
title: 'Notification title',
|
||||
callback: 'alert(\'Timer expired\')'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,8 +192,22 @@ const props = ref(refProps)
|
||||
const boundProps = computed(() => {
|
||||
const bound = {}
|
||||
for (const prop of props.value) {
|
||||
let value = prop.value
|
||||
if (!value) {
|
||||
continue
|
||||
}
|
||||
|
||||
try {
|
||||
bound[prop.key] = prop.type === 'Array' ? JSON.parse(prop.value) : prop.value
|
||||
if (prop.type === 'Array') {
|
||||
value = JSON.parse(value)
|
||||
} else if (prop.type === 'Number') {
|
||||
value = Number(value)
|
||||
} else if (prop.type === 'Function') {
|
||||
// eslint-disable-next-line no-new-func
|
||||
value = Function(value)
|
||||
}
|
||||
|
||||
bound[prop.key] = value
|
||||
} catch (e) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -170,6 +170,13 @@
|
||||
<UToggle v-model="isSwitchEnabled" icon-off="heroicons-solid:x" icon-on="heroicons-solid:check" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="font-medium text-sm mb-1 u-text-gray-700">
|
||||
Notifications:
|
||||
</div>
|
||||
<UButton icon="heroicons-outline:bell" variant="red" label="Trigger an error" @click="onNotificationClick" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="font-medium text-sm mb-1 u-text-gray-700">
|
||||
Card:
|
||||
@@ -200,6 +207,8 @@
|
||||
const isModalOpen = ref(false)
|
||||
const isSwitchEnabled = ref(false)
|
||||
|
||||
const { $toast } = useNuxtApp()
|
||||
|
||||
function toggleModalIsOpen () {
|
||||
isModalOpen.value = !isModalOpen.value
|
||||
}
|
||||
@@ -341,4 +350,8 @@ const solutions = [
|
||||
]
|
||||
|
||||
const description = ref('Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.')
|
||||
|
||||
const onNotificationClick = () => {
|
||||
$toast.error({ title: 'Error', description: 'This is an error message' })
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -187,7 +187,13 @@ const components = [
|
||||
},
|
||||
{
|
||||
label: 'Notification',
|
||||
to: '/components/Notification'
|
||||
to: '/components/Notification',
|
||||
nuxt3: true
|
||||
},
|
||||
{
|
||||
label: 'Notifications',
|
||||
to: '/components/Notifications',
|
||||
nuxt3: true
|
||||
},
|
||||
{
|
||||
label: 'Popover',
|
||||
@@ -201,7 +207,8 @@ const components = [
|
||||
},
|
||||
{
|
||||
label: 'Tooltip',
|
||||
to: '/components/Tooltip'
|
||||
to: '/components/Tooltip',
|
||||
nuxt3: true
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user