Prevent text jumping because of font-weight change on active tabs item

[MAILPOET-2776]
This commit is contained in:
Ján Mikláš
2020-06-18 17:43:43 +02:00
committed by Veljko V
parent 3ea9a299ea
commit d8e3e59e98
4 changed files with 14 additions and 3 deletions

View File

@@ -64,7 +64,7 @@
// Hack so the text is not jumping when changed to bold when active // Hack so the text is not jumping when changed to bold when active
&:before { &:before {
content: attr(title); content: attr(data-title);
display: block; display: block;
font-weight: bold; font-weight: bold;
height: 0; height: 0;

View File

@@ -58,6 +58,7 @@
background: $color-white; background: $color-white;
border-color: $color-tertiary-light; border-color: $color-tertiary-light;
color: $color-secondary; color: $color-secondary;
font-weight: bold;
} }
svg { svg {
@@ -78,6 +79,16 @@
margin-right: 0; margin-right: 0;
} }
} }
// Hack so the text is not jumping when changed to bold when active
> span:before {
content: attr(data-title);
display: block;
font-weight: bold;
height: 0;
overflow: hidden;
visibility: hidden;
}
} }
.mailpoet-tabs-title { .mailpoet-tabs-title {

View File

@@ -19,7 +19,7 @@ const Steps = ({ count, current, titles }: Props) => (
})} })}
> >
<div className="mailpoet-step-badge">{i >= current ? i : ''}</div> <div className="mailpoet-step-badge">{i >= current ? i : ''}</div>
{titles[i - 1] && <div className="mailpoet-step-title" title={titles[i - 1] || ''}>{titles[i - 1] || ''}</div>} {titles[i - 1] && <div className="mailpoet-step-title" data-title={titles[i - 1] || ''}>{titles[i - 1] || ''}</div>}
</div> </div>
))} ))}
</div> </div>

View File

@@ -73,7 +73,7 @@ const Tabs = ({
const title = (props) => ( const title = (props) => (
<> <>
{props.iconStart} {props.iconStart}
{props.title && <span>{props.title}</span>} {props.title && <span data-title={props.title}>{props.title}</span>}
{props.iconEnd} {props.iconEnd}
</> </>
); );