Pluralize button text based on number of files

This commit is contained in:
2026-04-21 09:38:25 +04:00
parent 4c540bc713
commit a89ba904c8

View File

@@ -37,6 +37,10 @@ export default class PlacePhotoUpload extends Component {
); );
} }
get photoWord() {
return this.files.length === 1 ? 'Photo' : 'Photos';
}
@action @action
handleFileSelect(event) { handleFileSelect(event) {
this.addFiles(event.target.files); this.addFiles(event.target.files);
@@ -251,7 +255,7 @@ export default class PlacePhotoUpload extends Component {
{{else}} {{else}}
Publish Publish
{{this.files.length}} {{this.files.length}}
Photo(s) {{this.photoWord}}
{{/if}} {{/if}}
</button> </button>
{{/if}} {{/if}}