From bb32708531bdc3fc2eefe62237370ab106726c26 Mon Sep 17 00:00:00 2001 From: astagnol <53512103+astagnol@users.noreply.github.com> Date: Fri, 24 Mar 2023 17:28:53 +0100 Subject: [PATCH] fix(button): fix width issue, ellipsis when flex & typo for lg (#16) Signed-off-by: aurore.stagnol --- .../components/osds-button/osds-button.scss | 26 ++++++++++--------- .../styles/osds-button.typography.scss | 2 +- .../stencil/components/button/src/index.html | 11 ++++++++ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packages/stencil/components/button/src/components/osds-button/osds-button.scss b/packages/stencil/components/button/src/components/osds-button/osds-button.scss index 42e0f5cc81..10f2308d32 100644 --- a/packages/stencil/components/button/src/components/osds-button/osds-button.scss +++ b/packages/stencil/components/button/src/components/osds-button/osds-button.scss @@ -15,6 +15,7 @@ overflow: hidden; padding: calc(var(--ods-size-inset-02) + var(--ods-size-inset-02)); width: var(--width); + min-width: 0; @include osds-button-on-main-element() { border-color: transparent; @@ -28,7 +29,7 @@ overflow: hidden; text-decoration: none; transition: all ease-in-out 100ms; - width: initial; + width: auto; @include osds-button-on-text-container() { align-items: center; @@ -38,11 +39,8 @@ grid-template: "start center end" / auto 1fr auto; height: 100%; justify-content: center; - overflow: hidden; position: relative; - text-overflow: ellipsis; - white-space: nowrap; - width: inherit; + max-width: inherit; } } } @@ -73,12 +71,20 @@ @include osds-button-on-main-element() { width: 100%; } + @include osds-button-on-text-container { + width: inherit; + } + + .button__centered-text { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + word-break: break-all; + } } slot { - display: flex; - align-self: center; - &[name="start"] { grid-area: start; justify-self: start; @@ -110,10 +116,6 @@ slot { .button__centered-text { grid-area: center; - display: flex; - place-items: center; - justify-self: center; - line-height: normal; } // apply the theme template for the component diff --git a/packages/stencil/components/button/src/components/osds-button/styles/osds-button.typography.scss b/packages/stencil/components/button/src/components/osds-button/styles/osds-button.typography.scss index 6af1c3c391..b3cacfa8b1 100644 --- a/packages/stencil/components/button/src/components/osds-button/styles/osds-button.typography.scss +++ b/packages/stencil/components/button/src/components/osds-button/styles/osds-button.typography.scss @@ -9,7 +9,7 @@ @mixin osds-button-theme-typography() { /** typography properties */ - @each $size in ('md','sm') { + @each $size in ('md','sm', 'lg') { :host([size='#{$size}']) .button__text-container { $typography-properties: ods-get-typography-properties(button, '100'); font-family: ods-get-typography-property($typography-properties, font-family); diff --git a/packages/stencil/components/button/src/index.html b/packages/stencil/components/button/src/index.html index 92bf1650a7..eaa7506b38 100644 --- a/packages/stencil/components/button/src/index.html +++ b/packages/stencil/components/button/src/index.html @@ -50,6 +50,17 @@ Square Square large +

Flex

+Default + +

Ellipsis

+ + start + Oles ipsum dolor sit amet, sem platform library data veeam vero quis scripta dicant te massa fuisset + signiferumque fringilla mus sodales diam eu mazim kpi mac sociis mi ls nullam cu information aperiri + end + +