Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
76 changes: 76 additions & 0 deletions lib/Styles/Granite/Button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
button {
.linked &,
.linked &.image-button,
.linked &.image-button.toggle {
@extend .text-button;

// Overwrite changes made further down the cascade due to the way
// @extend works
padding: 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This padding removal seems like an error?

Main:
Screenshot from 2025-06-03 11 42 00
Screenshot from 2025-06-03 11 44 51

This branch:
Screenshot from 2025-06-03 11 42 23
Screenshot from 2025-06-03 11 44 16

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button.text-button sets a padding of rem(2px) rem(4px), which then gets inherited when we extend it. This is supposed to override that and reset the padding. Before, we got around this by setting the padding for .text-button in a block specific to .text-button, and setting everything else in a shared block.

Compiled as it currently is, the padding is not being overridden. I'm not really sure why, though. Sheets might be cascading in a way I'm not expecting?

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you're saying. Because we want text buttons to have more horizontal padding and image buttons to have even padding all the way around.

Maybe what we need to do instead then is have a .raised style that just handles the borders and have .linked and .text-button extend that, separately

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split it out using a placeholder class. For some reason the checked and active selectors still had to be overriden


&:active,
&:checked {
@include control-active;

color: $fg-color;
filter: brightness(95%);
}
}

&.osd {
@include control;
@include border-interactive-roundrect;

// This stacks with the other shadows,
// so reduce it's alpha by the sum of other shadows
$shadow-border-color: scale-color($border-color, $alpha: -50%);
@if $color-scheme == "dark" {
$shadow-border-color: transparent
}

background-image: none;
border: none;
box-shadow:
highlight(),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(2);
color: $fg-color;
margin: 0;
padding: $button-spacing;

transition:
background duration("expand") easing(),
transform duration("expand") easing("ease-out-back");

&:active {
transition:
background duration("collapse") easing(),
transform duration("collapse") easing();
}

&:disabled {
@include control-disabled;

box-shadow:
highlight(),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(1);
}

.linked & {
transition: none;
transform: none;
}

.linked &.vertical &:first-child {
box-shadow:
highlight("top"),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(2);
}
}

}
1 change: 1 addition & 0 deletions lib/Styles/Granite/Index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '_classes.scss';
@import 'Box.scss';
@import 'Button.scss';
@import 'Dialog.scss';
@import 'Header.scss';
@import 'ListItem.scss';
Expand Down
64 changes: 2 additions & 62 deletions lib/Styles/Gtk/Button.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
button {

&.text-button {
padding: rem(2px) rem(4px);
}

&.image-button {
@extend .circular;

Expand Down Expand Up @@ -31,13 +27,12 @@ button {
}
}

.linked &,
.linked &.image-button,
.linked &.image-button.toggle,
&.text-button {
@include control;
@include border-interactive-roundrect;

padding: rem(2px) rem(4px);

&:active,
&:checked {
@include control-active;
Expand All @@ -57,61 +52,6 @@ button {
}
}

&.osd {
@include control;
@include border-interactive-roundrect;

// This stacks with the other shadows,
// so reduce it's alpha by the sum of other shadows
$shadow-border-color: scale-color($border-color, $alpha: -50%);
@if $color-scheme == "dark" {
$shadow-border-color: transparent
}

background-image: none;
border: none;
box-shadow:
highlight(),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(2);
color: $fg-color;
margin: 0;
padding: $button-spacing;

transition:
background duration("expand") easing(),
transform duration("expand") easing("ease-out-back");

&:active {
transition:
background duration("collapse") easing(),
transform duration("collapse") easing();
}

&:disabled {
@include control-disabled;

box-shadow:
highlight(),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(1);
}

.linked & {
transition: none;
transform: none;
}

.linked &.vertical &:first-child {
box-shadow:
highlight("top"),
// Intentionally not in ems since it's used as a stroke
0 0 0 1px $shadow-border-color,
shadow(2);
}
}

// Almost certainly a button with text and image
> box.horizontal {
Expand Down