-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Button Group] Add outlined prop #6788
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: '[Button Group] Add outlined prop' | ||
links: | ||
- https://github.com/palantir/blueprint/pull/6788 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ Markup: | |
.#{$ns}-fill - Buttons expand equally to fill container | ||
.#{$ns}-large - Use large buttons | ||
.#{$ns}-minimal - Use minimal buttons | ||
.#{$ns}-outlined - Use outlined buttons | ||
.#{$ns}-vertical - Vertical layout | ||
|
||
Styleguide button-group | ||
|
@@ -96,7 +97,7 @@ Styleguide button-group | |
} | ||
|
||
// support wrapping buttons in a tooltip, which adds a wrapper element | ||
&:not(.#{$ns}-minimal) { | ||
&:not(.#{$ns}-minimal), &.#{$ns}-outlined { | ||
> .#{$ns}-popover-wrapper:not(:first-child) .#{$ns}-button, | ||
> .#{$ns}-button:not(:first-child) { | ||
border-bottom-left-radius: 0; | ||
|
@@ -107,11 +108,17 @@ Styleguide button-group | |
> .#{$ns}-button:not(:last-child) { | ||
border-bottom-right-radius: 0; | ||
border-top-right-radius: 0; | ||
} | ||
} | ||
|
||
&:not(.#{$ns}-minimal):not(.#{$ns}-outlined) { | ||
> .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button, | ||
> .#{$ns}-button:not(:last-child) { | ||
margin-right: -$button-border-width; | ||
} | ||
} | ||
|
||
&.#{$ns}-minimal { | ||
&.#{$ns}-minimal, &.#{$ns}-outlined { | ||
.#{$ns}-button { | ||
@include pt-button-minimal(); | ||
} | ||
|
@@ -134,6 +141,18 @@ Styleguide button-group | |
} | ||
} | ||
|
||
&.#{$ns}-outlined { | ||
> .#{$ns}-button { | ||
@include pt-button-outlined(); | ||
} | ||
|
||
&:not(.#{$ns}-vertical) { | ||
> .#{$ns}-button:not(:last-child) { | ||
border-right: none; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here I think |
||
} | ||
} | ||
} | ||
|
||
.#{$ns}-popover-wrapper, | ||
.#{$ns}-popover-target { | ||
display: flex; | ||
|
@@ -213,7 +232,7 @@ Styleguide button-group | |
width: 100%; | ||
} | ||
|
||
&:not(.#{$ns}-minimal) { | ||
&:not(.#{$ns}-minimal), &.#{$ns}-outlined { | ||
> .#{$ns}-popover-wrapper:first-child .#{$ns}-button, | ||
> .#{$ns}-button:first-child { | ||
border-radius: $pt-border-radius $pt-border-radius 0 0; | ||
|
@@ -223,12 +242,20 @@ Styleguide button-group | |
> .#{$ns}-button:last-child { | ||
border-radius: 0 0 $pt-border-radius $pt-border-radius; | ||
} | ||
} | ||
|
||
&:not(.#{$ns}-minimal):not(.#{$ns}-outlined) { | ||
> .#{$ns}-popover-wrapper:not(:last-child) .#{$ns}-button, | ||
> .#{$ns}-button:not(:last-child) { | ||
margin-bottom: -$button-border-width; | ||
} | ||
} | ||
|
||
&.#{$ns}-outlined { | ||
> .#{$ns}-button:not(:last-child) { | ||
border-bottom: none; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we do a transparent color border instead of none here? |
||
} | ||
} | ||
} | ||
|
||
&.#{$ns}-align-left .#{$ns}-button { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,13 @@ export interface ButtonGroupProps extends Props, HTMLDivProps, React.RefAttribut | |
*/ | ||
minimal?: boolean; | ||
|
||
/** | ||
* Whether the child buttons should use outlined styles. | ||
* | ||
* @default false | ||
*/ | ||
outlined?: boolean; | ||
|
||
/** | ||
* Whether the child buttons should appear with large styling. | ||
* | ||
|
@@ -70,13 +77,14 @@ export interface ButtonGroupProps extends Props, HTMLDivProps, React.RefAttribut | |
*/ | ||
export const ButtonGroup: React.FC<ButtonGroupProps> = React.forwardRef<HTMLDivElement, ButtonGroupProps>( | ||
(props, ref) => { | ||
const { alignText, className, fill, minimal, large, vertical, ...htmlProps } = props; | ||
const { alignText, className, fill, minimal, outlined, large, vertical, ...htmlProps } = props; | ||
const buttonGroupClasses = classNames( | ||
Classes.BUTTON_GROUP, | ||
{ | ||
[Classes.FILL]: fill, | ||
[Classes.LARGE]: large, | ||
[Classes.MINIMAL]: minimal, | ||
[Classes.OUTLINED]: outlined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
[Classes.VERTICAL]: vertical, | ||
}, | ||
Classes.alignmentClass(alignText), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: '[Button Group] Add outlined prop' | ||
links: | ||
- https://github.com/palantir/blueprint/pull/6788 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed? I'm seeing the button group grow in size when
outlined
which I don't think is intentional(added some extra buttons locally to test)
vertical (extra 1px per button, expect for last is what I'd assume):
horizontal (2px per button):