Skip to content

Commit b433663

Browse files
committed
add InlineText component that force children to get displayed as inline content
1 parent 44dc5b2 commit b433663

4 files changed

Lines changed: 48 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1010

1111
- `<ApplicationViewability />`
1212
- component for hiding elements in specific media
13+
- `<InlineText />`
14+
- force children to get displayed as inline content
1315

1416
### Fixed
1517

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from "react";
2+
3+
import { TestableComponent } from "../interfaces";
4+
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
5+
6+
export interface InlineTextProps extends React.HTMLAttributes<HTMLElement>, TestableComponent {
7+
/**
8+
* Additional CSS class name.
9+
*/
10+
className?: string;
11+
}
12+
13+
/**
14+
* Forces all children to be displayed as inline content.
15+
*/
16+
export const InlineText = ({
17+
className = "",
18+
children,
19+
...otherProps
20+
}: InlineTextProps) => {
21+
22+
return (
23+
<div
24+
{...otherProps}
25+
className={
26+
`${eccgui}-typography__inlinetext` +
27+
(className ? " " + className : "")
28+
}
29+
>
30+
{children}
31+
</div>
32+
);
33+
};
34+
35+
export default InlineText;

src/components/Typography/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from "./Highlighter";
22
export * from "./HtmlContentBlock";
33
export * from "./OverflowText";
44
export * from "./WhiteSpaceContainer";
5+
export * from "./InlineText";

src/components/Typography/typography.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ table {
263263
}
264264
}
265265

266+
// InlineText
267+
268+
.#{$eccgui}-typography__inlinetext {
269+
display: inline;
270+
271+
* {
272+
display: inline;
273+
}
274+
}
275+
266276
// helpers
267277

268278
.#{$eccgui}-typography--nooverflow {

0 commit comments

Comments
 (0)