diff --git a/components/DocsSidebarNavigation.jsx b/components/DocsSidebarNavigation.jsx index 3e9fbe9..d1ca716 100644 --- a/components/DocsSidebarNavigation.jsx +++ b/components/DocsSidebarNavigation.jsx @@ -51,7 +51,7 @@ export function DocsSidebarNavigation({ className, data, navigation }) {
  • -

    +

    {section.title}

    @@ -61,7 +61,7 @@ export function DocsSidebarNavigation({ className, data, navigation }) { > , React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( - + { - return array.map(value => { - if (typeof value === 'object' && value !== null) { - return jsonToPhp(value); - } else if (Array.isArray(value)) { - return convertArray(value); - } else if (typeof value === 'string') { - return `'${value.replace(/'/g, "\\'")}'`; - } else if (typeof value === 'boolean') { - return value ? 'true' : 'false'; - } else { - return value; - } - }).join(", "); - }; - - let result = "array(\n"; - for (const key in obj) { - if (obj.hasOwnProperty(key)) { - const value = obj[key]; - result += `\t\t'${key}' => `; - if (Array.isArray(value)) { - result += convertArray(value) + ",\n"; - } else if (typeof value === 'object' && value !== null) { - result += jsonToPhp(value) + ",\n"; - } else { - result += `${value},\n`; - } - } - } - result += "\t)"; - return result; -} \ No newline at end of file + const convertArray = (array) => { + return array.map(value => { + if (typeof value === 'object' && value !== null) { + return jsonToPhp(value); + } else if (Array.isArray(value)) { + return convertArray(value); + } else if (typeof value === 'string') { + return `'${value.replace(/'/g, "\\'")}'`; + } else if (typeof value === 'boolean') { + return value ? 'true' : 'false'; + } else { + return value; + } + }).join(", "); + }; + + let result = "array(\n"; + for (const key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + const value = obj[key]; + result += `\t\t'${key}' => `; + if (Array.isArray(value)) { + result += convertArray(value) + ",\n"; + } else if (typeof value === 'object' && value !== null) { + result += jsonToPhp(value) + ",\n"; + } else { + result += `${value},\n`; + } + } + } + result += "\t)"; + return result; +} diff --git a/wp-blocks/AcfFieldTypeConfigurationBlock.js b/wp-blocks/AcfFieldTypeConfigurationBlock.js index 2145773..176b29d 100644 --- a/wp-blocks/AcfFieldTypeConfigurationBlock.js +++ b/wp-blocks/AcfFieldTypeConfigurationBlock.js @@ -1,11 +1,12 @@ -import React from 'react'; import { gql } from '@apollo/client' -import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'; -import { snakeToPascalCase } from '@/lib/snakeToPascalCase'; +import React from 'react'; + import { Card, CardHeader, } from '@/components/ui/card'; +import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'; +import { snakeToPascalCase } from '@/lib/snakeToPascalCase'; const EXAMPLE_KEY = 'example_key' diff --git a/wp-blocks/AcfFieldTypeSettingsBlock.js b/wp-blocks/AcfFieldTypeSettingsBlock.js index 7d1cdb0..8dc4fcd 100644 --- a/wp-blocks/AcfFieldTypeSettingsBlock.js +++ b/wp-blocks/AcfFieldTypeSettingsBlock.js @@ -1,34 +1,41 @@ -import React, { useState } from 'react'; import { gql } from '@apollo/client'; -import Image from 'next/image'; +import clsx from 'clsx' +import React, { useState } from 'react'; + import { Button } from "@/components/ui/button"; -import { Card, CardFooter, CardContent } from "@/components/ui/card"; +import { Card } from "@/components/ui/card"; -const AccordionItem = ({ title, content, isOpen, onClick }) => ( -
    - - {isOpen && ( -
    - {content} -
    - )} -
    -); +const AccordionItem = ({ title, content, isOpen, onClick }) => { + const buttonStyles = { + closed: + 'py-2 px-4 w-full text-left bg-white hover:bg-muted flex justify-between items-center text-black dark:bg-gray-800 dark:text-white', + open: + 'py-2 px-4 w-full text-left bg-muted hover:bg-muted flex justify-between items-center text-black dark:text-white', + } + + return ( +
    + + {isOpen && ( +
    + {content} +
    + )} +
    + ) +} export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) { const { fieldTypeSettings } = fieldTypeSettingsBlockFields; @@ -53,7 +60,7 @@ export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) { {fieldTypeSettings?.nodes?.map((item, index) => { const { id, name, description, fieldTypeSettingsMeta } = item; - const { impactOnWpgraphql, adminScreenshot } = fieldTypeSettingsMeta; + const { impactOnWpgraphql } = fieldTypeSettingsMeta; return ( - {adminScreenshot?.node && ( - {adminScreenshot?.node?.altText} - )} {description &&

    {description}

    } {impactOnWpgraphql && ( -
    - -
    + )} } @@ -83,10 +80,10 @@ export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) { ); })}
    -
    +
    @@ -112,6 +109,7 @@ AcfFieldTypeSettingsBlock.fragments = { name description fieldTypeSettingsMeta { + acfFieldName impactOnWpgraphql adminScreenshot { node { diff --git a/wp-blocks/index.js b/wp-blocks/index.js index f023151..359c717 100644 --- a/wp-blocks/index.js +++ b/wp-blocks/index.js @@ -1,9 +1,9 @@ import { CoreBlocks } from '@faustwp/blocks' -import { CoreHeading } from './CoreHeading' -import { AcfGraphqlQuery } from './AcfGraphqlQuery' -import { AcfFieldTypeSettingsBlock } from './AcfFieldTypeSettingsBlock' import { AcfFieldTypeConfigurationBlock } from './AcfFieldTypeConfigurationBlock' +import { AcfFieldTypeSettingsBlock } from './AcfFieldTypeSettingsBlock' +import { AcfGraphqlQuery } from './AcfGraphqlQuery' +import { CoreHeading } from './CoreHeading' const blocks = { ...CoreBlocks, diff --git a/wp-templates/single-field_type.js b/wp-templates/single-field_type.js index fa55c9a..55ba9c8 100644 --- a/wp-templates/single-field_type.js +++ b/wp-templates/single-field_type.js @@ -7,8 +7,8 @@ import Head from 'next/head' import { Layout } from '@/components/Layout' import { Badge } from '@/components/ui/badge' import blocks from '@/wp-blocks' -import { AcfFieldTypeSettingsBlock } from '@/wp-blocks/AcfFieldTypeSettingsBlock' import { AcfFieldTypeConfigurationBlock } from '@/wp-blocks/AcfFieldTypeConfigurationBlock' +import { AcfFieldTypeSettingsBlock } from '@/wp-blocks/AcfFieldTypeSettingsBlock' import { AcfGraphqlQuery } from '@/wp-blocks/AcfGraphqlQuery' export const SingleFieldType = ({ data }) => {