Skip to content

Commit

Permalink
chore: avoid using .fa() mixins and @fa-var vars
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Oct 27, 2023
1 parent 577fc3e commit d8265ec
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 29 deletions.
5 changes: 1 addition & 4 deletions extensions/mentions/less/forum.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
margin-left: 0;
}

// @TODO: 2.0 use an icon in the XSLT template.
&:before {
.fas();
content: @fa-var-reply;
.icon {
margin-right: 5px;
}
}
Expand Down
4 changes: 2 additions & 2 deletions extensions/mentions/src/ConfigureMentions.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ private function configurePostMentions(Configurator $config): void
$tag->template = '
<xsl:choose>
<xsl:when test="@deleted != 1">
<a href="{$DISCUSSION_URL}{@discussionid}/{@number}" class="PostMention" data-id="{@id}"><xsl:value-of select="@displayname"/></a>
<a href="{$DISCUSSION_URL}{@discussionid}/{@number}" class="PostMention" data-id="{@id}"><i class="icon fas fa-reply"></i><xsl:value-of select="@displayname"/></a>
</xsl:when>
<xsl:otherwise>
<span class="PostMention PostMention--deleted" data-id="{@id}"><xsl:value-of select="@displayname"/></span>
<span class="PostMention PostMention--deleted" data-id="{@id}"><i class="icon fas fa-reply"></i><xsl:value-of select="@displayname"/></span>
</xsl:otherwise>
</xsl:choose>';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export default class TagSelectionModal<
{tags.map((tag) => (
<li
data-index={tag.id()}
className={classList({
className={classList('SelectTagListItem', {
pinned: tag.position() !== null,
child: !!tag.parent(),
colored: !!tag.color(),
Expand All @@ -205,7 +205,10 @@ export default class TagSelectionModal<
onmouseover={() => (this.indexTag = tag)}
onclick={this.toggleTag.bind(this, tag)}
>
{tagIcon(tag)}
<i className="SelectTagListItem-icon">
{tagIcon(tag, { className: 'SelectTagListItem-tagIcon' })}
<i className="icon TagIcon fas fa-check SelectTagListItem-checkIcon"></i>
</i>
<span className="SelectTagListItem-name">{highlight(tag.name(), filter)}</span>
{tag.description() ? <span className="SelectTagListItem-description">{tag.description()}</span> : ''}
</li>
Expand Down
32 changes: 20 additions & 12 deletions extensions/tags/less/common/TagSelectionModal.less
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
}
}

.SelectTagListItem-checkIcon {
position: absolute;
inset: 0;
display: none;
background-color: transparent;
}

.SelectTagList {
padding: 0;
margin: 0;
Expand Down Expand Up @@ -124,26 +131,27 @@
}

&.selected {
.icon::before {
.fas();
content: @fa-var-check !important;
.SelectTagListItem-checkIcon {
display: inline-block;
color: var(--muted-color);
font-size: 14px;
text-align: center;
vertical-align: 1px;
}

&.colored .TagIcon:before {
.SelectTagListItem-tagIcon::before {
visibility: hidden;
}
&.colored .TagIcon + .SelectTagListItem-checkIcon {
color: #fff;
}
}
.TagIcon {
vertical-align: top;
margin-top: 3px;
margin-left: 0;
}
}
}
.SelectTagListItem-icon {
position: relative;
display: inline-block;
vertical-align: top;
margin-top: 3px;
margin-left: 0;
}
.SelectTagListItem-name {
display: inline-block;
width: 150px;
Expand Down
5 changes: 4 additions & 1 deletion framework/core/js/src/forum/components/Composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ export default class Composer extends Component {
items.add(
'minimize',
<ComposerButton
icon="fas fa-minus minimize"
icon={classList('fas minimize', {
'fa-minus': app.screen() !== 'phone',
'fa-times': app.screen() === 'phone',
})}
title={app.translator.trans('core.forum.composer.minimize_tooltip')}
onclick={this.state.minimize.bind(this.state)}
itemClassName="App-backControl"
Expand Down
1 change: 1 addition & 0 deletions framework/core/js/src/forum/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
})}
>
<div className="Search-input">
<Icon name="fas fa-search Search-input-icon" />
<input
aria-label={searchLabel}
className="FormControl"
Expand Down
4 changes: 1 addition & 3 deletions framework/core/less/common/Search.less
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
overflow: hidden;
color: var(--muted-color);

&:before {
.fas();
content: @fa-var-search;
&-icon {
margin-right: -36px;
width: 36px;
font-size: 14px;
Expand Down
3 changes: 2 additions & 1 deletion framework/core/less/common/Select.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
margin-left: -30px;
pointer-events: none;
color: var(--control-color);
.fa-fw();
text-align: center;
width: 1.25em;
}
3 changes: 2 additions & 1 deletion framework/core/less/common/Table.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
.icon {
font-size: 14px;
margin-right: 2px;
.fa-fw();
text-align: center;
width: 1.25em;
}
}

Expand Down
3 changes: 0 additions & 3 deletions framework/core/less/forum/Composer.less
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@
}
}
}
.Composer-controls .fa-minus:before {
content: @fa-var-times;
}
.composer-backdrop {
position: fixed;
top: 0;
Expand Down

0 comments on commit d8265ec

Please sign in to comment.