Sha256: a25fa084d3158e0993f0e1e27a4102269ea78bc09d1143062d0ce6f89b7c5e42

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

// @flow
import React from "react";
import type {ResourceField$String} from "../decls";

exports.getValue = function (field: ResourceField$String) {
  return field.value;
};

exports.Index = exports.Show = function (field: ResourceField$String) {
  return <span>{field.value}</span>;
};

exports.New = exports.Edit = function(field: ResourceField$String, onChange: (string, any) => void) {
  return (
    <input
      className="form-control"
      defaultValue={field.value}
      name={field.name}
      onChange={(e: SyntheticEvent) => {
        const el = e.target;
        if (el instanceof HTMLInputElement) {
          onChange(field.name, el.value);
        }
      }}
      type="text"
    />
  );
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin_core-0.0.2 client/src/resource-field/String.jsx
admin_core-0.0.1 client/src/resource-field/String.jsx