Skip to content

Commit

Permalink
fix: Update icon size on button tertiary
Browse files Browse the repository at this point in the history
  • Loading branch information
dinarosv committed Nov 15, 2021
1 parent ff1a9c7 commit 8e8b8ab
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,7 @@ export const ButtonTertiary = () => (
text={<span>Text inside additional span</span>}
icon_position="left"
icon="chevron_left"
left
/>
<Button
variant="tertiary"
size="large"
text="Large tertiary button"
icon="chevron_right"
left
right="1rem"
/>
`}
</ComponentBox>
Expand All @@ -120,14 +113,6 @@ export const ButtonTertiaryTop = () => (
icon_position="top"
icon="close"
text="Button text"
right="large"
/>
<Button
variant="tertiary"
icon_position="top"
icon="close"
size="large"
text="Button text"
/>
`}
</ComponentBox>
Expand Down
17 changes: 17 additions & 0 deletions packages/dnb-eufemia-sandbox/stories/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,23 @@ export const ButtonSandbox = () => (
<Button text="Signal" variant="signal" icon="add" />
<Button text="Signal" variant="signal" icon="add" disabled />
</Box>
<Box>
<Button variant="tertiary" text="Button text" icon="add" />

<Button
variant="tertiary"
text="Button text"
icon_position="top"
icon="add"
/>

<Button
variant="tertiary"
text="Button text"
icon="add"
icon_position="left"
/>
</Box>
</Wrapper>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,8 @@ exports[`Autocomplete scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
2 changes: 1 addition & 1 deletion packages/dnb-eufemia/src/components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default class Button extends React.PureComponent {
usedSize = 'default'
}
}
if (!iconSize && variant === 'tertiary' && usedSize === 'large') {
if (!iconSize && variant === 'tertiary' && icon_position === 'top') {
iconSize = 'medium'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,8 @@ exports[`Button scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/dnb-eufemia/src/components/button/style/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@
padding-right: 1rem;
}

&--tertiary &__text {
margin: 0;
}

// size default

/* stylelint-disable-next-line */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2199,6 +2199,8 @@ exports[`DatePicker scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,8 @@ exports[`Dropdown scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ exports[`GlobalError scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ exports[`GlobalStatus scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down Expand Up @@ -725,10 +727,8 @@ html[data-visual-test] .dnb-global-status__shell {
.dnb-global-status__close-button, .dnb-global-status__close-button.dnb-button--tertiary {
position: absolute;
z-index: 1;
top: -0.25rem;
right: 1rem;
left: auto;
margin-top: 0.75rem; }
left: auto; }
.dnb-modal__content__inner .dnb-global-status__close-button {
right: 0; }
Expand Down Expand Up @@ -942,7 +942,7 @@ exports[`GlobalStatus snapshot have to match component snapshot 1`] = `
wrap={null}
>
<button
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-global-status__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--icon-size-medium dnb-button--size-large"
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-global-status__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--size-large"
disabled={false}
onClick={[Function]}
title="close_text"
Expand All @@ -962,7 +962,7 @@ exports[`GlobalStatus snapshot have to match component snapshot 1`] = `
href={null}
icon="close"
icon_position="left"
icon_size="medium"
icon_size={null}
id={null}
innerRef={null}
inner_ref={null}
Expand Down Expand Up @@ -1007,34 +1007,34 @@ exports[`GlobalStatus snapshot have to match component snapshot 1`] = `
inherit_color={true}
key="button-icon"
modifier={null}
size="medium"
size={null}
skeleton={false}
title={null}
width={null}
>
<span
aria-hidden={true}
className="dnb-icon dnb-icon--medium dnb-button__icon dnb-icon--inherit-color"
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
role="presentation"
>
<close_medium>
<close>
<svg
fill="none"
height={24}
viewBox="0 0 24 24"
width={24}
height={16}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5 19L19 5M19 19L5 5"
d="M3 13L13 3M13 13L3 3"
stroke="black"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</svg>
</close_medium>
</close>
</span>
</IconPrimary>
</Content>
Expand Down Expand Up @@ -1325,7 +1325,7 @@ Array [
wrap={null}
>
<button
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-global-status__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--icon-size-medium dnb-button--size-large"
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-global-status__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--size-large"
disabled={false}
onClick={[Function]}
title="Lukk"
Expand All @@ -1345,7 +1345,7 @@ Array [
href={null}
icon="close"
icon_position="left"
icon_size="medium"
icon_size={null}
id={null}
innerRef={null}
inner_ref={null}
Expand Down Expand Up @@ -1390,34 +1390,34 @@ Array [
inherit_color={true}
key="button-icon"
modifier={null}
size="medium"
size={null}
skeleton={false}
title={null}
width={null}
>
<span
aria-hidden={true}
className="dnb-icon dnb-icon--medium dnb-button__icon dnb-icon--inherit-color"
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
role="presentation"
>
<close_medium>
<close>
<svg
fill="none"
height={24}
viewBox="0 0 24 24"
width={24}
height={16}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5 19L19 5M19 19L5 5"
d="M3 13L13 3M13 13L3 3"
stroke="black"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</svg>
</close_medium>
</close>
</span>
</IconPrimary>
</Content>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@
&__close-button.dnb-button--tertiary {
position: absolute;
z-index: 1;
top: -0.25rem;
right: 1rem; // also because of the focus-ring
left: auto;

margin-top: 0.75rem;
}
.dnb-modal__content__inner &__close-button {
right: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ exports[`InputMasked scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,8 @@ exports[`Input scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ exports[`Modal component have to match snapshot 1`] = `
class="dnb-modal__header__bar__close"
>
<button
class="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--icon-size-medium dnb-button--size-large"
class="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--size-large"
type="button"
>
<span
Expand All @@ -956,19 +956,19 @@ exports[`Modal component have to match snapshot 1`] = `
</span>
<span
aria-hidden="true"
class="dnb-icon dnb-icon--medium dnb-button__icon dnb-icon--inherit-color"
class="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
role="presentation"
>
<svg
fill="none"
height="24"
viewBox="0 0 24 24"
width="24"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5 19L19 5M19 19L5 5"
d="M3 13L13 3M13 13L3 3"
stroke="black"
stroke-linecap="round"
stroke-linejoin="round"
Expand Down Expand Up @@ -1034,7 +1034,7 @@ exports[`Modal component have to match snapshot 1`] = `
wrap={null}
>
<button
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--icon-size-medium dnb-button--size-large"
className="dnb-button dnb-button--tertiary dnb-button--has-text dnb-modal__close-button dnb-button--icon-position-left dnb-button--has-icon dnb-button--size-large"
disabled={false}
onClick={[Function]}
type="button"
Expand All @@ -1053,7 +1053,7 @@ exports[`Modal component have to match snapshot 1`] = `
href={null}
icon="close"
icon_position="left"
icon_size="medium"
icon_size={null}
id={null}
innerRef={null}
inner_ref={null}
Expand Down Expand Up @@ -1098,34 +1098,34 @@ exports[`Modal component have to match snapshot 1`] = `
inherit_color={true}
key="button-icon"
modifier={null}
size="medium"
size={null}
skeleton={false}
title={null}
width={null}
>
<span
aria-hidden={true}
className="dnb-icon dnb-icon--medium dnb-button__icon dnb-icon--inherit-color"
className="dnb-icon dnb-icon--default dnb-button__icon dnb-icon--inherit-color"
data-test-id="close icon"
role="presentation"
>
<close_medium>
<close>
<svg
fill="none"
height={24}
viewBox="0 0 24 24"
width={24}
height={16}
viewBox="0 0 16 16"
width={16}
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M5 19L19 5M19 19L5 5"
d="M3 13L13 3M13 13L3 3"
stroke="black"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={1.5}
/>
</svg>
</close_medium>
</close>
</span>
</IconPrimary>
</Content>
Expand Down Expand Up @@ -1570,6 +1570,8 @@ exports[`Modal scss have to match snapshot 1`] = `
padding-left: 1rem; }
.dnb-button--has-text.dnb-button--icon-position-right.dnb-button--size-large {
padding-right: 1rem; }
.dnb-button--tertiary .dnb-button__text {
margin: 0; }
.dnb-button--has-text {
width: auto; }
.dnb-button--has-text .dnb-button__icon {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8e8b8ab

Please sign in to comment.