Home / File/ LayoutViewer.js — react Source File

LayoutViewer.js — react Source File

Architecture documentation for LayoutViewer.js, a javascript file in the react codebase. 3 imports, 1 dependents.

File javascript CompilerCore Suppression 3 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  7f54edef_db24_124e_dc1a_13ad61cd7ab2["LayoutViewer.js"]
  359d113e_5377_affc_e86a_0928082a1e70["LayoutViewer.css"]
  7f54edef_db24_124e_dc1a_13ad61cd7ab2 --> 359d113e_5377_affc_e86a_0928082a1e70
  ffead8ae_d06e_e125_4014_a22fca24e35b["types.js"]
  7f54edef_db24_124e_dc1a_13ad61cd7ab2 --> ffead8ae_d06e_e125_4014_a22fca24e35b
  c745ba00_63aa_6e9b_0885_a745bade6cf7["react"]
  7f54edef_db24_124e_dc1a_13ad61cd7ab2 --> c745ba00_63aa_6e9b_0885_a745bade6cf7
  7e8ab39a_0f75_19cf_3c7a_63dcb7dd945d["index.js"]
  7e8ab39a_0f75_19cf_3c7a_63dcb7dd945d --> 7f54edef_db24_124e_dc1a_13ad61cd7ab2
  style 7f54edef_db24_124e_dc1a_13ad61cd7ab2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import styles from './LayoutViewer.css';

import type {Layout} from './types';

type Props = {
  id: number,
  layout: Layout,
};

export default function LayoutViewer({id, layout}: Props): React.Node {
  const {height, margin, padding, y, width, x} = layout;

  return (
    <div className={styles.LayoutViewer}>
      <div className={styles.Header}>layout</div>
      <div className={styles.DashedBox}>
        <div className={styles.LabelRow}>
          <label className={styles.Label}>margin</label>

          <label>{margin.top || '-'}</label>
        </div>

        <div className={styles.BoxRow}>
          <label>{margin.left || '-'}</label>

          <div className={styles.SolidBox}>
            <div className={styles.LabelRow}>
              <label className={styles.Label}>padding</label>

              <label>{padding.top || '-'}</label>
            </div>

            <div className={styles.BoxRow}>
              <label>{padding.left || '-'}</label>

              <div className={styles.DashedBox}>
                <div className={styles.LabelRow}>
                  {format(width)} x {format(height)} ({format(x)}, {format(y)})
                </div>
              </div>

              <label>{padding.right || '-'}</label>
            </div>

            <label>{padding.bottom || '-'}</label>
          </div>
          <label>{margin.right || '-'}</label>
        </div>
        <label>{margin.bottom || '-'}</label>
      </div>
    </div>
  );
}

function format(number: number): string | number {
  if (Math.round(number) === number) {
    return number;
  } else {
    return number.toFixed(1);
  }
}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does LayoutViewer.js do?
LayoutViewer.js is a source file in the react codebase, written in javascript. It belongs to the CompilerCore domain, Suppression subdomain.
What functions are defined in LayoutViewer.js?
LayoutViewer.js defines 2 function(s): LayoutViewer, format.
What does LayoutViewer.js depend on?
LayoutViewer.js imports 3 module(s): LayoutViewer.css, react, types.js.
What files import LayoutViewer.js?
LayoutViewer.js is imported by 1 file(s): index.js.
Where is LayoutViewer.js in the architecture?
LayoutViewer.js is located at packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/LayoutViewer.js (domain: CompilerCore, subdomain: Suppression, directory: packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free