Sha256: 7a383c57f3a56dc30de819f30830f4c5e211096d9159b19774e6cb7a0f6ec299

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

// @flow
import React from "react";
import {Link} from "react-router-dom";

import type {Resource} from "../decls";
import {renderIndex} from "../resource-field-renderer";

export default class ResourcesCollection extends React.Component {
  props: {
    attributes: string[];
    resources: Resource[];
  }

  render() {
    return (
      <table className="table table-bordered table-hover table-sm">
        <thead>
          <tr>
            {this.props.attributes.map((attribute, i) =>
              <th key={i}>{attribute}</th>
            )}
          </tr>
        </thead>
        <tbody>
          {this.props.resources.map((resource, i) =>
            <tr key={i}>
              {resource.fields.map((field, j) => {
                const showPath = resource.showPath;
                if (j === 0 && showPath) {
                  return <td key={j}><Link to={showPath}>{renderIndex(field)}</Link></td>;
                } else {
                  return <td key={j}>{renderIndex(field)}</td>;
                }
              })}
            </tr>
          )}
        </tbody>
      </table>
    );
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin_core-0.0.2 client/src/components/ResourcesCollection.jsx
admin_core-0.0.1 client/src/components/ResourcesCollection.jsx