Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Proxy Field Blocks #38

Merged
merged 7 commits into from
Nov 8, 2024
Merged

feat: Proxy Field Blocks #38

merged 7 commits into from
Nov 8, 2024

Conversation

dulnan
Copy link
Collaborator

@dulnan dulnan commented Nov 6, 2024

Implements #34

New proxyMode prop on <BlokkliField>

When this prop is set the field component won't render any block components, but instead a "proxy list" that renders an abstract view of the nested structure of the field. This is useful for things like sliders or other interactive blocks where drag and drop interactions are impossible because not all nested blocks are visible to the user in the editor.

image

The proxy list is rendered in-place of where blocks would normally be rendered. Since its style is position: absolute there must be a position: relative container where the proxy list is anchored.

Multiple levels of nesting are also supported. Once proxy mode is enabled on a field all nested fields are also automatically rendered in proxy mode.

By enabling proxy mode the rendering of the nested blocks is left to the component itself. It may iterate over the provided items and render <BlokkliItem> for each item or it may skip <BlokkliItem> to directly render the contents for maximum flexibility.

<template>
  <div class="relative">
    <BlokkliField v-slot="{ items }" name="slides" :list="slides" proxy-mode>
      <Carousel :items="items" />
    </BlokkliField>
  </div>
</template>

<script lang="ts" setup>
import type { FieldListItemTypedArray } from '#blokkli/generated-types'
import { defineBlokkli } from '#imports'

defineBlokkli({
  bundle: 'slider',
})

defineProps<{
  slides: FieldListItemTypedArray
}>()
</script>

Copy link

netlify bot commented Nov 6, 2024

Deploy Preview for blokkli ready!

Name Link
🔨 Latest commit 72dc235
🔍 Latest deploy log https://app.netlify.com/sites/blokkli/deploys/672e2641c9def200081c1dec
😎 Deploy Preview https://deploy-preview-38--blokkli.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 6, 2024

Deploy Preview for blokkli-docs ready!

Name Link
🔨 Latest commit 72dc235
🔍 Latest deploy log https://app.netlify.com/sites/blokkli-docs/deploys/672e2641f5a9980008faa2ea
😎 Deploy Preview https://deploy-preview-38--blokkli-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dulnan dulnan merged commit 53af2b2 into main Nov 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant