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(button group): fix border disappears in button group with disable (port of 1139) #1148

Merged
merged 4 commits into from
Jan 22, 2024
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
15 changes: 14 additions & 1 deletion .storybook/stories/button/button-group.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const defaultStory: Story = args => ({
<clr-button
*ngFor="let _ of createArray(buttonCount); let i = index"
[clrInMenu]="false"
[disabled]="disabledButtonsPosition.includes(i+1)"
>
{{content}} {{i + 1}}
</clr-button>
Expand Down Expand Up @@ -48,6 +49,7 @@ const defaultParameters: Parameters = {
createArray: { control: { disable: true }, table: { disable: true } },
buttonCount: { control: { type: 'number', min: 1, max: 100 } },
inMenuButtonCount: { control: { type: 'number', min: 1, max: 100 } },
disabledButtonsPosition: { description: 'Enter JSON array (e.g. `[2,3]`)', control: { type: 'array' } },
},
args: {
// story helpers
Expand All @@ -56,9 +58,20 @@ const defaultParameters: Parameters = {
content: 'Hello World!',
buttonCount: 3,
inMenuButtonCount: 3,
disabledButtonsPosition: [],
},
};

const variants: Parameters[] = [];
const variants: Parameters[] = [
{
disabledButtonsPosition: [],
},
{
disabledButtonsPosition: [2],
},
{
disabledButtonsPosition: [2, 3],
},
];

setupStorybook(ClrButtonGroupModule, defaultStory, defaultParameters, variants);
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
&:not(:last-child) {
@include square-off-btngroup-btns(right);
}

&:disabled:not(:last-child) {
border-right: none;
}
}

.tooltip {
Expand Down Expand Up @@ -98,15 +102,15 @@
}

//To avoid double borders
.btn + .btn {
.btn:not([disabled]) + .btn {
border-left: none;
}

.tooltip:not(:first-child) .btn {
border-left: none;
}

.btn + .btn-group-overflow {
.btn:not([disabled]) + .btn-group-overflow {
.btn {
border-left: none;
}
Expand Down
Binary file modified tests/snapshots/button/button-group--variants-core-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/button/button-group--variants-core-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.