Skip to content

Commit

Permalink
fix: permission grid styling broken
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Jan 31, 2025
1 parent d3d73ac commit 5c8e2b9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions extensions/tags/js/src/admin/addTagsPermissionScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ export default function () {
'tag',
<Dropdown
className="Dropdown--restrictByTag"
buttonClassName="Button Button--text"
buttonClassName="Button Button--link"
label={app.translator.trans('flarum-tags.admin.permissions.restrict_by_tag_heading')}
icon="fas fa-plus"
caretIcon={null}
>
{tags.map((tag) => (
<Button icon={true} onclick={() => tag.save({ isRestricted: true })}>
{[tagIcon(tag, { className: 'Button-icon' }), ' ', tag.name()]}
<Button icon={tagIcon(tag, { className: 'Button-icon' })} onclick={() => tag.save({ isRestricted: true })}>
{tag.name()}
</Button>
))}
</Dropdown>
Expand Down
9 changes: 6 additions & 3 deletions framework/core/js/src/common/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ export interface IButtonAttrs extends ComponentAttrs {
* Class(es) of an optional icon to be rendered within the button.
*
* If provided, the button will gain a `has-icon` class.
*
* You may also provide a rendered icon element directly.
*/
icon?: string;
icon?: string | Mithril.Children;
/**
* Disables button from user input.
*
Expand Down Expand Up @@ -80,6 +82,7 @@ export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> ext
hasIcon: iconName,
disabled: disabled || loading,
loading: loading,
hasSubContent: !!this.getButtonSubContent(),
});

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

return [
iconName && <Icon name={iconName} className="Button-icon" />,
icon ? typeof icon === 'string' ? <Icon name={icon} className="Button-icon" /> : icon : null,
children && (
<span className="Button-label">
<span className="Button-labelText">{children}</span>
Expand Down
16 changes: 4 additions & 12 deletions framework/core/less/admin/PermissionsPage.less
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,19 @@
}
}
.Dropdown {
display: block;

.Dropdown-toggle {
width: 100%;
display: block;
text-align: left;
float: none;
margin: -2px 0;
}
.Dropdown-menu {
margin: 0;
margin: 6px 0 0;
}
}
.Button {
text-decoration: none;

.Badge {
margin: -3px 2px -3px 0;
margin: 0 2px 0 0;
}
}
td:not(:hover) .Select-caret,
Expand All @@ -126,12 +122,8 @@
margin: -1px 0;
}
.PermissionDropdown {
.Dropdown-toggle {
padding: 5px 0;
margin: -5px 0;
}
.Badge {
margin: -3px 3px -3px 0;
margin: 0 3px 0 0;
box-shadow: none;
}
}
Expand Down
5 changes: 5 additions & 0 deletions framework/core/less/common/Dropdown.less
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
padding: 8px 15px;
display: flex;
gap: 9px;
align-items: center;
width: 100%;
color: var(--text-color);
border-radius: 0;
Expand All @@ -50,6 +51,10 @@
flex-shrink: 0;
}

&.hasSubContent {
align-items: flex-start;
}

&.disabled {
opacity: 0.4;
background: none !important;
Expand Down

0 comments on commit 5c8e2b9

Please sign in to comment.