Skip to content

Commit

Permalink
feat(lr-file-uploader-regular): added prop headless
Browse files Browse the repository at this point in the history
Added the ability to use the headless attribute to hide/visible a button
  • Loading branch information
Egor Didenko committed May 29, 2024
1 parent f2e29f3 commit 5e58ff4
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion solutions/file-uploader/regular/FileUploaderRegular.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
// @ts-check
import { SolutionBlock } from '../../../abstract/SolutionBlock.js';
import { EventType } from '../../../blocks/UploadCtxProvider/EventEmitter.js';
import { asBoolean } from '../../../blocks/Config/normalizeConfigValue.js';

export class FileUploaderRegular extends SolutionBlock {
constructor() {
super();

this.init$ = {
...this.init$,
isHidden: false,
};
}

initCallback() {
super.initCallback();

this.defineAccessor(
'headless',
/** @param {unknown} value */ (value) => {
this.set$({ isHidden: asBoolean(value) });
},
);

this.sub(
'*modalActive',
(modalActive) => {
Expand All @@ -22,7 +39,7 @@ export class FileUploaderRegular extends SolutionBlock {
}

FileUploaderRegular.template = /* HTML */ `
<lr-simple-btn></lr-simple-btn>
<lr-simple-btn set="@hidden: isHidden"></lr-simple-btn>
<lr-modal strokes block-body-scrolling>
<lr-start-from>
Expand All @@ -40,3 +57,8 @@ FileUploaderRegular.template = /* HTML */ `
<lr-progress-bar-common></lr-progress-bar-common>
`;

FileUploaderRegular.bindAttributes({
// @ts-expect-error TODO: fix types inside symbiote
headless: null,
});

0 comments on commit 5e58ff4

Please sign in to comment.