docs(ComponentExample): add iframeMobile prop

This commit is contained in:
Benjamin Canac
2024-12-27 15:28:22 +01:00
parent 91da9aa83a
commit e878115a73

View File

@@ -11,6 +11,11 @@ const props = withDefaults(defineProps<{
* @defaultValue false * @defaultValue false
*/ */
iframe?: boolean | { [key: string]: any } iframe?: boolean | { [key: string]: any }
/**
* Whether to display the component in a mobile-sized iframe viewport
* @defaultValue false
*/
iframeMobile?: boolean
props?: { [key: string]: any } props?: { [key: string]: any }
/** /**
* Whether to format the code with Prettier * Whether to format the code with Prettier
@@ -189,8 +194,8 @@ const urlSearchParams = computed(() => new URLSearchParams({ ...optionsValues.va
v-if="iframe" v-if="iframe"
v-bind="typeof iframe === 'object' ? iframe : {}" v-bind="typeof iframe === 'object' ? iframe : {}"
:src="`/examples/${name}?${urlSearchParams}`" :src="`/examples/${name}?${urlSearchParams}`"
class="relative w-full lg:left-1/2 lg:-translate-x-1/2 lg:w-[1024px]" class="relative w-full"
:class="props.class" :class="[props.class, !iframeMobile && 'lg:left-1/2 lg:-translate-x-1/2 lg:w-[1024px]']"
/> />
<div v-else class="flex justify-center p-4" :class="props.class"> <div v-else class="flex justify-center p-4" :class="props.class">
<component :is="camelName" v-bind="{ ...componentProps, ...optionsValues }" /> <component :is="camelName" v-bind="{ ...componentProps, ...optionsValues }" />