Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Actions styling in Breadcrumbs #2991

Merged
merged 2 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/components/Actions/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,19 @@ export default {
default: false,
},

/**
* Specifies the button type used for trigger and single actions buttons
* Accepted values: primary, secondary, tertiary, tertiary-no-background, tertiary-on-primary, error, warning, success. If left empty,
* the default button style will be applied.
*/
type: {
type: String,
validator(value) {
return ['primary', 'secondary', 'tertiary', 'tertiary-no-background', 'tertiary-on-primary', 'error', 'warning', 'success'].indexOf(value) !== -1
},
default: null,
},

/**
* Aria label for the actions menu
*/
Expand Down Expand Up @@ -723,7 +736,7 @@ export default {
},
props: {
// If it has a title, we use a secondary button
type: title ? 'secondary' : 'tertiary',
type: this.type || (title ? 'secondary' : 'tertiary'),
disabled: this.disabled || firstAction?.componentOptions?.propsData?.disabled,
...firstAction?.componentOptions?.propsData,
},
Expand Down Expand Up @@ -807,10 +820,10 @@ export default {
class: 'action-item__menutoggle',
props: {
// If requested, we use a primary button
type: this.primary
type: this.type || (this.primary
? 'primary'
// If it has a title, we use a secondary button
: this.menuTitle ? 'secondary' : 'tertiary',
: this.menuTitle ? 'secondary' : 'tertiary'),
disabled: this.disabled,
},
slot: 'trigger',
Expand Down
36 changes: 7 additions & 29 deletions src/components/Breadcrumb/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ This component is meant to be used inside a Breadcrumbs component.
</element>
<Actions v-if="$slots.default"
ref="actions"
type="tertiary"
:force-menu="forceMenu"
:open="open"
:menu-title="title"
Expand Down Expand Up @@ -300,40 +301,17 @@ export default {
&::v-deep .action-item {
// Adjustments necessary to correctly shrink on small screens
max-width: 100%;
.trigger {
max-width: 100%;
}

&__menutoggle--with-title,
&--single--with-title {
// Adjustments necessary to correctly shrink on small screens
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
display: inline-block;

background-color: unset;
border: none;

&:hover,
&:focus,
&:active {
background-color: var(--color-background-dark) !important;
color: var(--color-main-text);
}
.button-vue {
padding: 0 4px 0 16px;

// Show the icon on the right
padding-right: 44px;
padding-left: 14px;
& > span.material-design-icon {
right: 0;
left: unset;
&__wrapper {
flex-direction: row-reverse;
}
}

// Adjust the background of the last crumb when the action is open
&.action-item--open .action-item__menutoggle--with-title {
&.action-item--open .action-item__menutoggle {
background-color: var(--color-background-dark);
color: var(--color-main-text);
}
Expand Down