Skip to content

Commit eca975f

Browse files
authored
fix: support null and callback refs for gridRef warn
- GlobalSpotlight: allow gridRef prop to be HTMLDivElement|null (default: null) - BentoCardGrid: change gridRef prop to Function callback type - MagicBento.vue: pass gridRef via callback to child and guard GlobalSpotlight render until gridRef is set - Updated type annotations and prop validations accordingly"
1 parent f126758 commit eca975f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/content/Components/MagicBento/MagicBento.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ const ParticleCard = defineComponent({
378378
const GlobalSpotlight = defineComponent({
379379
name: 'GlobalSpotlight',
380380
props: {
381-
gridRef: { type: Object as PropType<HTMLDivElement | null>, required: true },
381+
gridRef: {type: [Object, null] as PropType<HTMLDivElement | null>, required: true},
382382
disableAnimations: { type: Boolean, default: false },
383383
enabled: { type: Boolean, default: true },
384384
spotlightRadius: { type: Number, default: DEFAULT_SPOTLIGHT_RADIUS },
@@ -539,7 +539,10 @@ const GlobalSpotlight = defineComponent({
539539
const BentoCardGrid = defineComponent({
540540
name: 'BentoCardGrid',
541541
props: {
542-
gridRef: { type: Object }
542+
gridRef: {
543+
type: Function as PropType<(el: HTMLDivElement | null) => void>,
544+
required: true
545+
}
543546
},
544547
template: `
545548
<div

0 commit comments

Comments
 (0)