From 532ebc864da6cdc9ec6ee80b67047d685ecec900 Mon Sep 17 00:00:00 2001 From: emyarod Date: Tue, 14 Jan 2020 18:41:35 -0600 Subject: [PATCH] fix(tabs): truncate container tab header text with ellipses (#5035) --- .../components/src/components/tabs/_tabs.scss | 17 ++++++++++++----- .../components/src/components/tabs/tabs.hbs | 2 +- packages/react/src/components/Tabs/Tabs-test.js | 4 ++-- packages/react/src/components/Tabs/Tabs.js | 6 +++--- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/components/src/components/tabs/_tabs.scss b/packages/components/src/components/tabs/_tabs.scss index b348cfd25a86..b36064cc451e 100644 --- a/packages/components/src/components/tabs/_tabs.scss +++ b/packages/components/src/components/tabs/_tabs.scss @@ -42,7 +42,7 @@ display: flex; align-items: center; justify-content: space-between; - padding: 0 $spacing-05; + padding: 0 $spacing-09 0 $spacing-05; height: rem(40px); cursor: pointer; color: $text-01; @@ -60,8 +60,8 @@ } .#{$prefix}--tabs-trigger svg { - width: rem(12px); - height: rem(7px); + position: absolute; + right: $spacing-05; fill: $ui-05; transition: transform $duration--fast-01 motion(standard, productive); } @@ -90,6 +90,9 @@ padding-top: 2px; color: $text-01; font-weight: 400; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .#{$prefix}--tabs-trigger-text:hover { @@ -274,6 +277,9 @@ background-color: $ui-01; .#{$prefix}--tabs__nav-link { + line-height: calc( + #{rem(48px)} - (#{$spacing-03} * 2) + ); // height - vertical padding // Draws the border without affecting the inner-content box-shadow: inset 0 2px 0 0 $interactive-04; border-bottom: none; @@ -333,9 +339,10 @@ .#{$prefix}--tabs--container a.#{$prefix}--tabs__nav-link { @include carbon--breakpoint(md) { - display: flex; - align-items: center; height: rem(48px); + line-height: calc( + #{rem(48px)} - (#{$spacing-03} * 2) + ); // height - vertical padding border-bottom: none; } } diff --git a/packages/components/src/components/tabs/tabs.hbs b/packages/components/src/components/tabs/tabs.hbs index 497cc894630f..f05daa97795c 100644 --- a/packages/components/src/components/tabs/tabs.hbs +++ b/packages/components/src/components/tabs/tabs.hbs @@ -8,7 +8,7 @@
- {{ carbon-icon 'ChevronDownGlyph' }} + {{ carbon-icon 'ChevronDown16' }}