✨ Asynchronous ✨ multiple fields ✨ Sanity UI ✨ Easy! ✨
Show multiple fields in an object field, based on a condition set through the "options" object. Simply return true/false from "condition" function, even asynchronously!
// Simple implementation of https://github.com/sanity-io/sanity/blob/21af6baffe88d57db32d0a05e048ef7d3d671523/packages/%40sanity/form-builder/src/inputs/ArrayInput/ArrayFunctions.tsx | |
import React from "react"; | |
import DropDownButton from "part:@sanity/components/buttons/dropdown"; | |
import Button from "part:@sanity/components/buttons/default"; | |
import ButtonGrid from "part:@sanity/components/buttons/button-grid"; | |
import styles from "./styles/ArrayInput.css"; | |
export default class ArrayFunctions extends React.Component { | |
handleDropDownAction = (menuItem) => { |
/*----------------------- | |
Offset | |
--- | |
Get the offset of an element on the page relative to the document. | |
-----------------------*/ | |
function offset(el) { | |
const rect = el.getBoundingClientRect(), | |
scrollTop = window.pageYOffset || document.documentElement.scrollTop; | |
return { top: rect.top + scrollTop, bottom: rect.bottom + scrollTop }; |
import useScrollRestoration from "utils/hooks/useScrollRestoration"; | |
const App = ({ Component, pageProps, router }) => { | |
useScrollRestoration(router); | |
return <Component {...pageProps} />; | |
}; | |
export default App; |
<?php | |
/** | |
* Plugin Name: Convert ACF PHP to JSON | |
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON. | |
*/ | |
namespace ConvertAcfPhpToJson; | |
/** | |
* Add submenu item under 'Custom Fields' |
This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form>
following the example by Martin Hawksey
Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.
You should be able to just open index.html
in your browser and test locally.