CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/components/nowrap.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
interface Props {
7
tag?: "span" | "div";
8
style?: React.CSSProperties;
9
children?: React.ReactNode;
10
}
11
12
export const NoWrap: React.FC<Props> = ({
13
children,
14
tag = "span",
15
style,
16
}: Props) => {
17
const elStyle: React.CSSProperties = { whiteSpace: "nowrap", ...style };
18
switch (tag) {
19
case "span":
20
return <span style={elStyle}>{children}</span>;
21
case "div":
22
return <div style={elStyle}>{children}</div>;
23
}
24
};
25
26