Skip to content

Commit

Permalink
Adds hint--fit width feature
Browse files Browse the repository at this point in the history
This patch adds the "hint--fit" class and also set "box-sizing: border-box" to all size related classes.

The "border-box" sizing will prevent border and padding stylization to overflow the parent limit.

closes #197
  • Loading branch information
aurium committed Oct 3, 2021
1 parent dc22dde commit 02e8401
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ <h3>Size variations</h3>
<a class="hint--top hint--large" style="border: 1px solid #eee;padding:3px 6px;border-radius:4px;" data-hint="You can show very very long sentences inside tooltips by using various available size variation classes.">
Large
</a>

<a class="hint--top hint--fit" style="border: 1px solid #eee;padding:3px 56px;border-radius:4px;" data-hint="You can show very very long sentences inside tooltips by using various available size variation classes.">
Fit
</a>
</p>


Expand Down
9 changes: 8 additions & 1 deletion src/hint-sizes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

.#{$hintPrefix}small,
.#{$hintPrefix}medium,
.#{$hintPrefix}large {
.#{$hintPrefix}large,
.#{$hintPrefix}fit {
&:after {
box-sizing: border-box;
white-space: normal;
line-height: 1.4em;
word-wrap: break-word; // Ensure long words do not overflow.
Expand All @@ -37,3 +39,8 @@
width: $hintSizeLarge;
}
}
.#{$hintPrefix}fit {
&:after {
width: 100%;
}
}

0 comments on commit 02e8401

Please sign in to comment.