Add Meta Pixel block

Closes #582
This commit is contained in:
Baptiste Arnaud
2023-06-28 09:52:03 +02:00
parent 92f7f3cbe2
commit 033f8f99dd
39 changed files with 826 additions and 38 deletions

View File

@@ -9,7 +9,7 @@ import {
} from '@chakra-ui/react'
import { TrashIcon, PlusIcon } from '@/components/icons'
import { createId } from '@paralleldrive/cuid2'
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
type ItemWithId<T> = T & { id: string }
@@ -40,6 +40,10 @@ export const TableList = <T,>({
const [items, setItems] = useState(initialItems)
const [showDeleteIndex, setShowDeleteIndex] = useState<number | null>(null)
useEffect(() => {
if (items.length && initialItems.length === 0) setItems(initialItems)
}, [initialItems, items.length])
const createItem = () => {
const id = createId()
const newItem = { id, ...newItemDefaultProps } as ItemWithId<T>