Skip to content

Commit

Permalink
format labels for drop down options
Browse files Browse the repository at this point in the history
  • Loading branch information
mlwilkerson committed May 23, 2024
1 parent 97baf4f commit 64fc0f7
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Prop,
State
} from "@stencil/core";
import { debounce, find, get, set, size } from "lodash";
import { capitalize, debounce, find, get, set, size } from "lodash";
import {
buildIconChooserResult,
CONSOLE_MESSAGE_PREFIX,
Expand Down Expand Up @@ -580,6 +580,13 @@ export class FaIconChooser {
e.stopPropagation();
}

labelForFamilyOrStyle(labelOrFamily: string) : string {
return labelOrFamily
.split('-')
.map((term) => capitalize(term))
.join(' ')
}

render() {
if (this.fatalError) {
return (
Expand Down Expand Up @@ -644,7 +651,7 @@ export class FaIconChooser {
onChange={this.selectFamily.bind(this)}
>
{this.getFamilies().map((family: string) => (
<option value={family}>{family}</option>
<option value={family}>{this.labelForFamilyOrStyle(family)}</option>
))}
</select>
</div>
Expand All @@ -655,7 +662,7 @@ export class FaIconChooser {
onChange={this.selectStyle.bind(this)}
>
{this.getStylesForSelectedFamily().map((style: string) => (
<option value={style}>{style}</option>
<option value={style}>{this.labelForFamilyOrStyle(style)}</option>
))}
</select>
</div>
Expand Down

0 comments on commit 64fc0f7

Please sign in to comment.