Skip to content

Commit 22ca229

Browse files
author
Douglas Fabris
authored
fix: withRichContent prop split to fit in different contexts (#401)
1 parent 79405d3 commit 22ca229

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed

packages/fuselage/fuselage.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ declare module '@rocket.chat/fuselage' {
142142

143143
elevation?: '0' | '1' | '2';
144144
invisible?: boolean;
145-
withRichContent?: boolean;
145+
withRichContent?: boolean | string;
146146
withTruncatedText?: boolean;
147147
size?: CSSProperties['blockSize'];
148148
minSize?: CSSProperties['blockSize'];

packages/fuselage/src/components/Box/index.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,22 @@ export const useBoxOnlyProps = (props) => {
5252
}
5353

5454
if (props.withRichContent) {
55-
props.className = prependClassName(
56-
props.className,
57-
'rcx-box--with-inline-elements'
58-
);
59-
props.className = prependClassName(
60-
props.className,
61-
'rcx-box--with-block-elements'
62-
);
55+
if (props.withRichContent === 'inlineWithoutBreaks') {
56+
props.className = prependClassName(
57+
props.className,
58+
'rcx-box--with-inline-elements'
59+
);
60+
} else {
61+
props.className = prependClassName(
62+
props.className,
63+
'rcx-box--with-inline-elements'
64+
);
65+
66+
props.className = prependClassName(
67+
props.className,
68+
'rcx-box--with-block-elements'
69+
);
70+
}
6371
}
6472

6573
delete props.withRichContent;

packages/fuselage/src/styles/primitives/traits/rich-text.scss

+38
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,38 @@
101101
}
102102
}
103103

104+
ul,
105+
ol {
106+
display: inline-flex;
107+
}
108+
109+
li {
110+
display: list-item;
111+
112+
margin-inline-start: lengths.margin(24);
113+
margin-inline-end: lengths.margin(8);
114+
115+
&:first-child {
116+
margin-inline-start: lengths.margin(16);
117+
}
118+
}
119+
120+
ul {
121+
list-style-type: disc;
122+
123+
span {
124+
margin-inline-end: lengths.margin(8);
125+
}
126+
127+
input {
128+
vertical-align: middle;
129+
}
130+
}
131+
132+
ol {
133+
list-style-type: decimal;
134+
}
135+
104136
code {
105137
display: inline;
106138

@@ -288,11 +320,17 @@
288320
li {
289321
display: list-item;
290322

323+
margin-inline-start: lengths.margin(0);
324+
291325
text-align: inherit;
292326

293327
color: inherit;
294328

295329
font: inherit;
330+
331+
&:first-child {
332+
margin-inline-start: lengths.margin(0);
333+
}
296334
}
297335

298336
pre {

0 commit comments

Comments
 (0)