Skip to content

Commit

Permalink
fix: withRichContent prop split to fit in different contexts (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
Douglas Fabris committed Feb 22, 2021
1 parent 79405d3 commit 22ca229
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/fuselage/fuselage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ declare module '@rocket.chat/fuselage' {

elevation?: '0' | '1' | '2';
invisible?: boolean;
withRichContent?: boolean;
withRichContent?: boolean | string;
withTruncatedText?: boolean;
size?: CSSProperties['blockSize'];
minSize?: CSSProperties['blockSize'];
Expand Down
24 changes: 16 additions & 8 deletions packages/fuselage/src/components/Box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,22 @@ export const useBoxOnlyProps = (props) => {
}

if (props.withRichContent) {
props.className = prependClassName(
props.className,
'rcx-box--with-inline-elements'
);
props.className = prependClassName(
props.className,
'rcx-box--with-block-elements'
);
if (props.withRichContent === 'inlineWithoutBreaks') {
props.className = prependClassName(
props.className,
'rcx-box--with-inline-elements'
);
} else {
props.className = prependClassName(
props.className,
'rcx-box--with-inline-elements'
);

props.className = prependClassName(
props.className,
'rcx-box--with-block-elements'
);
}
}

delete props.withRichContent;
Expand Down
38 changes: 38 additions & 0 deletions packages/fuselage/src/styles/primitives/traits/rich-text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,38 @@
}
}

ul,
ol {
display: inline-flex;
}

li {
display: list-item;

margin-inline-start: lengths.margin(24);
margin-inline-end: lengths.margin(8);

&:first-child {
margin-inline-start: lengths.margin(16);
}
}

ul {
list-style-type: disc;

span {
margin-inline-end: lengths.margin(8);
}

input {
vertical-align: middle;
}
}

ol {
list-style-type: decimal;
}

code {
display: inline;

Expand Down Expand Up @@ -288,11 +320,17 @@
li {
display: list-item;

margin-inline-start: lengths.margin(0);

text-align: inherit;

color: inherit;

font: inherit;

&:first-child {
margin-inline-start: lengths.margin(0);
}
}

pre {
Expand Down

0 comments on commit 22ca229

Please sign in to comment.