Sha256: d0f58c38d7381bd7d66b94c1a9563668dd801abf64e1f4712b237e9d6c191974

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

import React from "react";

import * as PageEditor from "../../types/PageEditor";
import { MaybeLocalizedValue } from "../../types";
import { blockValue, errorsOn, unconfiguredBlocks } from "./usePage";

import Block from "./Block";

interface Props {
  state: PageEditor.State;
  dispatch: (action: PageEditor.Action) => void;
}

export default function UnconfiguredContent(props: Props) {
  const { state, dispatch } = props;

  const { page, locale, inputDir } = state;

  const handleChange = (attr: string) => (value: MaybeLocalizedValue) => {
    dispatch({ type: "updateBlocks", payload: { [attr]: value } });
  };

  return (
    <React.Fragment>
      <p>
        This page has additional content fields not enabled by the selected
        template.
      </p>
      {unconfiguredBlocks(state).map((b) => (
        <Block
          key={b.name}
          block={b}
          errors={errorsOn(page, b.name)}
          dir={inputDir}
          lang={locale}
          onChange={handleChange(b.name)}
          value={blockValue(state, b)}
        />
      ))}
    </React.Fragment>
  );
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pages_core-3.15.4 app/javascript/components/PageForm/UnconfiguredContent.tsx
pages_core-3.15.3 app/javascript/components/PageForm/UnconfiguredContent.tsx
pages_core-3.15.2 app/javascript/components/PageForm/UnconfiguredContent.tsx
pages_core-3.15.1 app/javascript/components/PageForm/UnconfiguredContent.tsx