Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/frontend/react-components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from "./button/Button";
export * from "./text/Text";
export * from "./nowrap/NoWrap";
export * from "./spacer/Spacer";
export * from "./theme-provider/ThemeProvider";
16 changes: 16 additions & 0 deletions packages/frontend/react-components/src/nowrap/NoWrap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from "react";

const space = {
flex: "1",
pointerEvents: "none"
} as const;

export const Spacer: React.FC<JSX.IntrinsicElements["div"]> = props => (
<div
{...props}
style={{
...space,
...props.style
}}
/>
);
23 changes: 23 additions & 0 deletions packages/frontend/react-components/src/spacer/Spacer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as React from "react";

const noWrap = { whiteSpace: "nowrap" } as const;

/**
* Sometimes with text-wrapping its desired to ensure a string of words appear
* on the same line, or to avoid the one word on a line scenario
* @example
* // OH NO
* big
* apple
* // WINNING
* big apple
*/
export const NoWrap: React.FC<JSX.IntrinsicElements["span"]> = props => (
<span
{...props}
style={{
...noWrap,
...props.style
}}
/>
);