-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02445aa
commit 13612b7
Showing
7 changed files
with
101 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { components } from "nextjs-drupal-webform" | ||
import classNames from "classnames" | ||
|
||
const buttonDecorator = (DecoratedComponent) => { | ||
return function WebformCustomTable(props) { | ||
const fieldProps = props.fieldProps ?? {} | ||
const additionalClasses = [] | ||
if (props.element["#button_type"] === "primary") { | ||
additionalClasses.push("bg-black hover:bg-black text-white") | ||
} | ||
fieldProps.className = classNames(fieldProps.className, additionalClasses) | ||
|
||
return <DecoratedComponent {...props} fieldProps={fieldProps} /> | ||
} | ||
} | ||
|
||
export default buttonDecorator(components.button) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { DrupalClient } from "next-drupal" | ||
|
||
export const drupal = new DrupalClient( | ||
process.env.NEXT_PUBLIC_DRUPAL_BASE_URL, | ||
{ | ||
previewSecret: process.env.DRUPAL_PREVIEW_SECRET, | ||
auth: { | ||
clientId: process.env.DRUPAL_CLIENT_ID, | ||
clientSecret: process.env.DRUPAL_CLIENT_SECRET, | ||
scope: | ||
"administrator developer site_builder content_administrator content_author content_editor user_administrator headless", | ||
}, | ||
// @see https://github.com/vercel/next.js/discussions/32238 | ||
// @see https://github.com/vercel/next.js/blob/d895a50abbc8f91726daa2d7ebc22c58f58aabbb/packages/next/server/api-utils/node.ts#L504 | ||
forceIframeSameSiteCookie: process.env.NODE_ENV === "development", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { NextApiRequest, NextApiResponse } from "next" | ||
import { drupal } from "../../lib/drupal" | ||
import { WebformDefaultApiRoute } from "nextjs-drupal-webform" | ||
|
||
export default async function handler( | ||
request: NextApiRequest, | ||
response: NextApiResponse | ||
) { | ||
return WebformDefaultApiRoute(request, response, drupal) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters