Skip to content

Commit

Permalink
Updated editor modal Closes #8 #16 #12
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervriends committed Nov 25, 2021
1 parent c584971 commit 2e1f970
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 8 deletions.
35 changes: 27 additions & 8 deletions js/src/admin/components/EditBadgeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default class EditBadgeModal extends Modal {
else {
items.add(
"icon",
<div className="Form-group BadgeForm-split" style="position: relative;">
<div className="Form-group BadgeForm-split BadgeForm-IconField">
<label>
{app.translator.trans(
"v17development-flarum-badges.admin.badge.icon"
Expand All @@ -180,17 +180,14 @@ export default class EditBadgeModal extends Modal {
placeholder="fas fa-icons"
bidi={this.icon}
/>
<i
className={this.icon() || "fas fa-icons "}
style="position: absolute; bottom: 8px; right: 15px; font-size: 20px;"
/>
<span className={this.icon() || "fas fa-icons "} />
</div>,
50
);

items.add(
"icon_color",
<div className="Form-group BadgeForm-split">
<div className="Form-group BadgeForm-split BadgeForm-ColorField">
<label>
{app.translator.trans(
"v17development-flarum-badges.admin.badge.icon_color"
Expand All @@ -202,13 +199,19 @@ export default class EditBadgeModal extends Modal {
placeholder="auto"
bidi={this.iconColor}
/>
<span
className={"BadgeForm-Chosen-Color"}
style={{
backgroundColor: this.iconColor(),
}}
/>
</div>,
50
);

items.add(
"background_color",
<div className="Form-group BadgeForm-split">
<div className="Form-group BadgeForm-split BadgeForm-ColorField">
<label>
{app.translator.trans(
"v17development-flarum-badges.admin.badge.background_color"
Expand All @@ -220,13 +223,19 @@ export default class EditBadgeModal extends Modal {
bidi={this.backgroundColor}
placeholder="auto"
/>
<span
className={"BadgeForm-Chosen-Color"}
style={{
backgroundColor: this.backgroundColor(),
}}
/>
</div>,
50
);

items.add(
"label_color",
<div className="Form-group BadgeForm-split">
<div className="Form-group BadgeForm-split BadgeForm-ColorField">
<label>
{app.translator.trans(
"v17development-flarum-badges.admin.badge.label_color"
Expand All @@ -238,6 +247,12 @@ export default class EditBadgeModal extends Modal {
placeholder="auto"
bidi={this.labelColor}
/>
<span
className={"BadgeForm-Chosen-Color"}
style={{
backgroundColor: this.labelColor(),
}}
/>
</div>,
50
);
Expand Down Expand Up @@ -281,8 +296,12 @@ export default class EditBadgeModal extends Modal {
.save({
name: this.name(),
icon: this.icon(),
image: this.image(),
description: this.description(),
isVisible: this.isVisible(),
iconColor: this.iconColor(),
backgroundColor: this.backgroundColor(),
labelColor: this.labelColor(),
})
.then(
() => this.hide(),
Expand Down
24 changes: 24 additions & 0 deletions less/Admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,27 @@
}
}
}

.BadgeForm-ColorField {
position: relative;

.BadgeForm-Chosen-Color {
position: absolute;
width: 14px;
height: 14px;
bottom: 10px;
right: 15px;
border-radius: 100%;
}
}

.BadgeForm-IconField {
position: relative;

> span {
position: absolute;
bottom: 8px;
right: 15px;
font-size: 20px;
}
}

0 comments on commit 2e1f970

Please sign in to comment.