Skip to content

Commit

Permalink
Merge pull request #48 from wp-graphql/feat/add-field-setting-key-to-…
Browse files Browse the repository at this point in the history
…field-settings-accordion

feat: dark-mode support for Algolia
  • Loading branch information
jasonbahl authored Jan 9, 2024
2 parents 488468d + 342135e commit 315707f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
22 changes: 12 additions & 10 deletions components/PrimaryNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function PrimaryNavigation({ navigation }) {
{navigation.map((item) => {
if (item.links.length == 0) {
return (
<NavigationMenuItem key={item.id}>
<NavigationMenuItem key={item?.id}>
<Link href={item.href} legacyBehavior passHref>
<NavigationMenuLink
className={navigationMenuTriggerStyle()}
Expand All @@ -56,7 +56,7 @@ export function PrimaryNavigation({ navigation }) {
<NavigationMenuItem key={item.id}>
<NavigationMenuTrigger>{item?.label}</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="grid gap-3 p-4 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]">
<ul className="grid gap-2 p-4 md:w-[400px] lg:w-[500px] lg:grid-cols-[.75fr_1fr]">
{item.links.map((sublink) => {
if (sublink.menuItemMeta?.isFeatured) {
return (
Expand All @@ -80,14 +80,16 @@ export function PrimaryNavigation({ navigation }) {
)
} else {
return (
<ListItem
key={sublink.id}
href={sublink.href}
target={sublink?.target ?? null}
title={sublink.label}
>
{sublink.menuItemMeta?.description}
</ListItem>
<NavigationMenuLink asChild key={sublink.id}>
<ListItem
key={sublink.id}
href={sublink.href}
target={sublink?.target ?? null}
title={sublink.label}
>
{sublink.menuItemMeta?.description}
</ListItem>
</NavigationMenuLink>
)
}
})}
Expand Down
1 change: 0 additions & 1 deletion pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import blocks from '@/wp-blocks'
export default function MyApp({ Component, pageProps, router }) {
return (
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
Expand Down
2 changes: 1 addition & 1 deletion styles/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
--radius: 0.5rem;
}

.dark {
[data-theme='dark'] {
--background: 224 71% 4%;
--foreground: 213 31% 91%;

Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'./wp-templates/**/*.{js,mjs,jsx,mdx,tsx,ts}',
'./wp-templates/*.{js,mjs,jsx,mdx,tsx,ts}',
],
darkMode: 'class',
darkMode: [ 'class', '[data-theme="dark"]'],
theme: {
fontSize: {
xs: ['0.75rem', { lineHeight: '1rem' }],
Expand Down
10 changes: 6 additions & 4 deletions wp-blocks/AcfFieldTypeSettingsBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,23 @@ export function AcfFieldTypeSettingsBlock({ fieldTypeSettingsBlockFields }) {

return (
<>
<p>Below you will find information about how various ACF field settings can impact how the field will map to the GraphQL Schema and/or modify resolution of the field when queried.</p>
<Card>
<CardHeader className="grid grid-cols-[1fr_110px] items-start space-y-2">
{fieldTypeSettings?.nodes?.map((item, index) => {
const { id, name, description, fieldTypeSettingsMeta } = item;
const { impactOnWpgraphql } = fieldTypeSettingsMeta;
const { impactOnWpgraphql, acfFieldName } = fieldTypeSettingsMeta;

return (
<AccordionItem
key={id}
title={name}
title={`${name}`}
content={
<>
{description && <p>{description}</p>}
{acfFieldName && <><p><code className='mb-10'>{acfFieldName}</code></p></>}
{description && <><p>{description}</p></>}
{impactOnWpgraphql && (
<span dangerouslySetInnerHTML={{ __html: impactOnWpgraphql }} />
<><strong>Impact on the GraphQL</strong><span dangerouslySetInnerHTML={{ __html: impactOnWpgraphql }} /></>
)}
</>
}
Expand Down
2 changes: 1 addition & 1 deletion wp-blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { CoreBlocks } from '@faustwp/blocks'
import { AcfFieldTypeConfigurationBlock } from './AcfFieldTypeConfigurationBlock'
import { AcfFieldTypeSettingsBlock } from './AcfFieldTypeSettingsBlock'
import { AcfGraphqlQuery } from './AcfGraphqlQuery'
import { CoreHeading } from './CoreHeading'
import { CoreCode } from './CoreCode'
import { CoreHeading } from './CoreHeading'

const blocks = {
...CoreBlocks,
Expand Down

1 comment on commit 315707f

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
acf.wpgraphql.com main https://hb…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

Please sign in to comment.