MCPcopy Create free account
hub / github.com/bridge-codes/bridge / NewCustomCodeLine

Function NewCustomCodeLine

www/src/components/NewCode.tsx:146–200  ·  view source on GitHub ↗
({ line, typesToDisplay, showLineNumber, lineNumber, getLineProps, getTokenProps, hide, highlight }:
  {
    line: any;
    lineNumber: number;
    showLineNumber: boolean;
    typesToDisplay: TypeViewInferface[];
    getLineProps: any;
    getTokenProps: any;
    hide: boolean;
    highlight: boolean
  }
)

Source from the content-addressed store, hash-verified

144}
145
146const NewCustomCodeLine = ({ line, typesToDisplay, showLineNumber, lineNumber, getLineProps, getTokenProps, hide, highlight }:
147 {
148 line: any;
149 lineNumber: number;
150 showLineNumber: boolean;
151 typesToDisplay: TypeViewInferface[];
152 getLineProps: any;
153 getTokenProps: any;
154 hide: boolean;
155 highlight: boolean
156 }
157) => {
158 return (
159 <div className="transition-all duration-700"
160 style={{
161 display: 'block',
162 opacity: hide ? 0 : 1,
163 maxHeight: hide ? 0 : 25,
164 background: highlight ? "rgb(255, 255, 255, 0.04)" : "rgb(255, 255, 255, 0)",
165 borderLeftStyle: "solid",
166 borderLeftWidth: 4,
167 borderLeftColor: highlight ? "#A175FF" : "rgb(255,255,255,0)",
168 overflow: hide ? 'hidden' : 'none'
169 }}>
170 {showLineNumber &&
171 <div
172 style={{
173 fontSize: 14,
174 textAlign: 'right',
175 userSelect: 'none',
176 opacity: 0.5,
177 paddingRight: '1em',
178 paddingLeft: '0.5em',
179 }}
180 >
181 {lineNumber + 1}
182 </div>
183 }
184 <div style={{
185 width: "100%",
186 fontSize: '14px',
187 padding: "2px 20px"
188 }}>
189 {line.map((token, key) => {
190 const toShow = typesToDisplay.find((el) => { return el.token === token.content.trim() && el.line + 1 === lineNumber })
191 console.log(token)
192 if (toShow) {
193 return (<span data-lsp={toShow.code} className="bg-white bg-opacity-5 transition-all hover:bg-opacity-10 border border-white border-opacity-25 hover:border-opacity-40 cursor-default rounded-md relative" style={{ padding: "0px 0px" }}> <span key={key} {...getTokenProps({ token, key })} /> </span>)
194 }
195 return (<span key={key} {...getTokenProps({ token, key })} />)
196 })}
197 </div>
198 </div>
199 )
200}
201
202const NewCustomCodeLineMemo = memo(NewCustomCodeLine)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected