Skip to content

Commit

Permalink
fix: add offset for wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Feverqwe authored and 3y3 committed Mar 25, 2024
1 parent 60914c2 commit db017da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/components/TocLable/TocLabel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
@import '../../styles/mixins';

.dc-toc-label {
margin-left: 10px;
&_offset {
margin-left: 10px;

[dir='rtl'] & {
margin-right: 10px;
[dir='rtl'] & {
margin-right: 10px;
}
}
}
12 changes: 9 additions & 3 deletions src/components/TocLable/TocLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ const TocLabel: FC<TocLabelProps> = ({label}) => {

let labelElement = null;
if (label?.title) {
const hasDescription = Boolean(label.description);
labelElement = (
<Label size={'xs'} theme={label.theme} className={b()}>
<Label size={'xs'} theme={label.theme} className={b({offset: !hasDescription})}>
{label.title}
</Label>
);
if (label.description) {
if (hasDescription) {
const placement = direction === 'rtl' ? 'left' : 'right';
labelElement = (
<Popover content={label.description} placement={placement} size={'s'}>
<Popover
content={label.description}
placement={placement}
size={'s'}
className={b({offset: true})}
>
{labelElement}
</Popover>
);
Expand Down

0 comments on commit db017da

Please sign in to comment.