Skip to content

Commit 5c8e2b9

Browse files
committed
fix: permission grid styling broken
1 parent d3d73ac commit 5c8e2b9

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

extensions/tags/js/src/admin/addTagsPermissionScope.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ export default function () {
7878
'tag',
7979
<Dropdown
8080
className="Dropdown--restrictByTag"
81-
buttonClassName="Button Button--text"
81+
buttonClassName="Button Button--link"
8282
label={app.translator.trans('flarum-tags.admin.permissions.restrict_by_tag_heading')}
8383
icon="fas fa-plus"
8484
caretIcon={null}
8585
>
8686
{tags.map((tag) => (
87-
<Button icon={true} onclick={() => tag.save({ isRestricted: true })}>
88-
{[tagIcon(tag, { className: 'Button-icon' }), ' ', tag.name()]}
87+
<Button icon={tagIcon(tag, { className: 'Button-icon' })} onclick={() => tag.save({ isRestricted: true })}>
88+
{tag.name()}
8989
</Button>
9090
))}
9191
</Dropdown>

framework/core/js/src/common/components/Button.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export interface IButtonAttrs extends ComponentAttrs {
1111
* Class(es) of an optional icon to be rendered within the button.
1212
*
1313
* If provided, the button will gain a `has-icon` class.
14+
*
15+
* You may also provide a rendered icon element directly.
1416
*/
15-
icon?: string;
17+
icon?: string | Mithril.Children;
1618
/**
1719
* Disables button from user input.
1820
*
@@ -80,6 +82,7 @@ export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> ext
8082
hasIcon: iconName,
8183
disabled: disabled || loading,
8284
loading: loading,
85+
hasSubContent: !!this.getButtonSubContent(),
8386
});
8487

8588
const buttonAttrs = {
@@ -110,10 +113,10 @@ export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> ext
110113
* Get the template for the button's content.
111114
*/
112115
protected getButtonContent(children: Mithril.Children): Mithril.ChildArray {
113-
const iconName = this.attrs.icon;
116+
const icon = this.attrs.icon;
114117

115118
return [
116-
iconName && <Icon name={iconName} className="Button-icon" />,
119+
icon ? typeof icon === 'string' ? <Icon name={icon} className="Button-icon" /> : icon : null,
117120
children && (
118121
<span className="Button-label">
119122
<span className="Button-labelText">{children}</span>

framework/core/less/admin/PermissionsPage.less

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,19 @@
9494
}
9595
}
9696
.Dropdown {
97-
display: block;
98-
9997
.Dropdown-toggle {
10098
width: 100%;
101-
display: block;
102-
text-align: left;
103-
float: none;
99+
margin: -2px 0;
104100
}
105101
.Dropdown-menu {
106-
margin: 0;
102+
margin: 6px 0 0;
107103
}
108104
}
109105
.Button {
110106
text-decoration: none;
111107

112108
.Badge {
113-
margin: -3px 2px -3px 0;
109+
margin: 0 2px 0 0;
114110
}
115111
}
116112
td:not(:hover) .Select-caret,
@@ -126,12 +122,8 @@
126122
margin: -1px 0;
127123
}
128124
.PermissionDropdown {
129-
.Dropdown-toggle {
130-
padding: 5px 0;
131-
margin: -5px 0;
132-
}
133125
.Badge {
134-
margin: -3px 3px -3px 0;
126+
margin: 0 3px 0 0;
135127
box-shadow: none;
136128
}
137129
}

framework/core/less/common/Dropdown.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
padding: 8px 15px;
2929
display: flex;
3030
gap: 9px;
31+
align-items: center;
3132
width: 100%;
3233
color: var(--text-color);
3334
border-radius: 0;
@@ -50,6 +51,10 @@
5051
flex-shrink: 0;
5152
}
5253

54+
&.hasSubContent {
55+
align-items: flex-start;
56+
}
57+
5358
&.disabled {
5459
opacity: 0.4;
5560
background: none !important;

0 commit comments

Comments
 (0)