MCPcopy Create free account
hub / github.com/tensorflow/tfjs / render

Method render

tfjs-vis/src/components/surface.tsx:57–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 }
56
57 render() {
58 const { name, visible, styles } = this.props;
59 const finalStyles = {
60 ...SurfaceComponent.defaultStyles,
61 ...styles,
62 };
63
64 const { width, height, } = finalStyles;
65 let { maxHeight, maxWidth, } = finalStyles;
66 maxHeight = height === SurfaceComponent.defaultStyles.height ?
67 maxHeight : height;
68 maxWidth = width === SurfaceComponent.defaultStyles.width ?
69 maxWidth : width;
70
71 const surfaceStyle = css({
72 display: visible ? 'block' : 'none',
73 backgroundColor: 'white',
74 marginTop: '10px',
75 marginBottom: '10px',
76 boxShadow: '0 0 6px -3px #777',
77 padding: '10px !important',
78 height,
79 width,
80 maxHeight,
81 maxWidth,
82 overflow: 'auto',
83 });
84
85 const labelStyle = css({
86 backgroundColor: 'white',
87 boxSizing: 'border-box',
88 borderBottom: '1px solid #357EDD',
89 lineHeight: '2em',
90 marginBottom: '20px',
91 fontWeight: '600',
92 textAlign: 'center',
93 });
94
95 const drawAreaStyle = css({
96 boxSizing: 'border-box',
97 });
98
99 return (
100 <div
101 className={`${surfaceStyle} tf-surface`}
102 ref={(r) => this.container = r}
103 data-visible={visible}
104 >
105 <div className={`${labelStyle} tf-label`} ref={(r) => this.label = r}>
106 {name}
107 </div>
108
109 <div
110 className={`${drawAreaStyle} tf-draw-area`}
111 ref={(r) => this.drawArea = r}
112 />
113 </div>
114 );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected