MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Indent

Function Indent

packages/dev/docs/src/types.js:240–249  ·  view source on GitHub ↗
({params, open, close, children, alwaysIndent})

Source from the content-addressed store, hash-verified

238const IndentContext = React.createContext({small: '', large: ''});
239
240export function Indent({params, open, close, children, alwaysIndent}) {
241 let {small, large} = useContext(IndentContext);
242
243 if (params.length === 0) {
244 open = <span className="token punctuation">{open}</span>;
245 close = <span className="token punctuation">{close}</span>;
246 } else if (params.length > 2 || alwaysIndent) {
247 // Always indent.
248 open = <span className="token punctuation">{open.trimEnd() + '\n' + large + ' '}</span>;
249 close = <span className="token punctuation">{'\n' + large + close.trimStart()}</span>;
250 large += ' ';
251 small += ' ';
252 } else {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected