primevue-mirror/doc/galleria/theming/TailwindDoc.vue

154 lines
6.1 KiB
Vue

<template>
<DocSectionText v-bind="$attrs">
<p>
PrimeVue offers a built-in Tailwind theme to get you started quickly. The default values related to the component are displayed below. The component can easily be styled with your own design based on Tailwind utilities, see the
<PrimeVueNuxtLink to="/tailwind">Tailwind Customization</PrimeVueNuxtLink> section for an example.
</p>
<DocSectionCode :code="code1" hideToggleCode importCode hideCodeSandbox hideStackBlitz />
<p>A playground sample with the pre-built Tailwind theme.</p>
<DocSectionCode :code="code2" embedded :service="['PhotoService']" />
</DocSectionText>
</template>
<script>
export default {
data() {
return {
code1: {
basic: `
export default {
galleria: {
root: 'flex flex-col',
content: 'flex flex-col',
itemwrapper: 'flex flex-col relative',
itemcontainer: 'relative flex h-full',
item: 'flex justify-center items-center h-full w-full',
thumbnailwrapper: 'flex flex-col overflow-auto shrink-0',
thumbnailcontainer: {
class: ['flex flex-row', 'bg-black/90 p-4']
},
previousthumbnailbutton: {
class: [
'self-center flex shrink-0 justify-center items-center overflow-hidden relative',
'm-2 bg-transparent text-white w-8 h-8 transition duration-200 ease-in-out rounded-full',
'hover:bg-white/10 hover:text-white',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)]'
]
},
thumbnailitemscontainer: 'overflow-hidden w-full',
thumbnailitems: 'flex',
thumbnailitem: {
class: ['overflow-auto flex items-center justify-center cursor-pointer opacity-50', 'flex-1 grow-0 shrink-0 w-20', 'hover:opacity-100 hover:transition-opacity hover:duration-300']
},
nextthumbnailbutton: {
class: [
'self-center flex shrink-0 justify-center items-center overflow-hidden relative',
'm-2 bg-transparent text-white w-8 h-8 transition duration-200 ease-in-out rounded-full',
'hover:bg-white/10 hover:text-white',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)]'
]
},
indicators: {
class: ['flex items-center justify-center', 'p-4']
},
indicator: 'mr-2',
indicatorbutton: ({ context }) => ({
class: [
'w-4 h-4 transition duration-200 rounded-full',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]',
{
'bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600': !context.highlighted,
'bg-blue-500 hover:bg-blue-600': context.highlighted
}
]
}),
mask: {
class: ['fixed top-0 left-0 w-full h-full', 'flex items-center justify-center', 'bg-black bg-opacity-90']
},
closebutton: {
class: [
'absolute top-0 right-0 flex justify-center items-center overflow-hidden m-2',
'text-white bg-transparent w-12 h-12 rounded-full transition duration-200 ease-in-out',
'hover:text-white hover:bg-white/10',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)]'
]
},
closeicon: 'w-6 h-6',
previousitembutton: {
class: [
'inline-flex justify-center items-center overflow-hidden',
'bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md mx-2',
'fixed top-1/2 mt-[-0.5rem]',
'left-0',
'hover:bg-white/10 hover:text-white',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)]'
]
},
nextitembutton: {
class: [
'inline-flex justify-center items-center overflow-hidden',
'bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md mx-2',
'fixed top-1/2 mt-[-0.5rem]',
'right-0',
'hover:bg-white/10 hover:text-white',
'focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)]'
]
},
caption: {
class: ['absolute bottom-0 left-0 w-full', 'bg-black/50 text-white p-4']
},
transition: {
enterFromClass: 'opacity-0 scale-75',
enterActiveClass: 'transition-all duration-150 ease-in-out',
leaveActiveClass: 'transition-all duration-150 ease-in',
leaveToClass: 'opacity-0 scale-75'
}
}
}
`
},
code2: {
composition: `
<template>
<div class="card md:flex md:justify-center">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px">
<template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%" />
</template>
<template #thumbnail="slotProps">
<img :src="slotProps.item.thumbnailImageSrc" :alt="slotProps.item.alt" />
</template>
</Galleria>
</div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { PhotoService } from '@/service/PhotoService';
onMounted(() => {
PhotoService.getImages().then((data) => (images.value = data));
});
const images = ref();
const responsiveOptions = ref([
{
breakpoint: '991px',
numVisible: 4
},
{
breakpoint: '767px',
numVisible: 3
},
{
breakpoint: '575px',
numVisible: 1
}
]);
<\/script>`
}
};
}
};
</script>