forked from forcedotcom/commerce-on-lightning-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinputFacetLabelGenerator.js
More file actions
23 lines (22 loc) · 861 Bytes
/
inputFacetLabelGenerator.js
File metadata and controls
23 lines (22 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* For full license text, see the LICENSE file in the repo
* root or https://opensource.org/licenses/apache-2-0/
*/
import labels from './labels';
/**
* @param {boolean} expanded Whether we display all the facet values or not
* @param {?string} facetName The facet name in the label, only used for the aria label attribute
* @returns {string}
* A localized label for the toggled state of the 'Show More' button.
*/
export default function generateLabel(expanded, facetName) {
if (facetName) {
let labelSrc = expanded ? labels.showLessAriaLabel : labels.showMoreAriaLabel;
labelSrc = labelSrc.replace('{name}', facetName);
return labelSrc;
}
return expanded ? labels.showLessLabel : labels.showMoreLabel;
}