Skip to content

Commit

Permalink
fix(core/drawer|inputgroup): fixed drawer display issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Demirci committed Nov 13, 2024
1 parent 1a13a46 commit 752cc62
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/components/drawer/drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
visibility: hidden;

display: flex;
position: absolute;
position: fixed;
flex-flow: column nowrap;
justify-content: flex-start;
align-items: center;
transform: translateX(16rem);
opacity: 0;

max-height: 100vh;
min-height: $large-space;
background-color: var(--theme-color-1);
border-radius: $default-border-radius;

transition: all var(--theme-medium-time) ease-out;
transition: transform var(--theme-medium-time) ease-out;

.toggle {
z-index: 100;
Expand Down
11 changes: 3 additions & 8 deletions packages/core/src/components/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export class Drawer {
private divElement?: HTMLElement;

@Watch('show')
onShowChanged(newValue: boolean) {
onShowChanged(newValue: boolean, oldValue?:boolean) {

Check failure on line 73 in packages/core/src/components/drawer/drawer.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `·`
if(newValue === !!oldValue) return;

Check failure on line 74 in packages/core/src/components/drawer/drawer.tsx

View workflow job for this annotation

GitHub Actions / build

Insert `·`
this.show = newValue !== undefined ? newValue : !this.show;
this.toggleDrawer(this.show);
}
Expand Down Expand Up @@ -127,9 +128,6 @@ export class Drawer {
translateX: [0, '16rem'],
opacity: [1, 0],
easing: 'easeInSine',
complete: () => {
el.classList.add('d-none');
},
});
}

Expand All @@ -140,9 +138,6 @@ export class Drawer {
translateX: ['16rem', 0],
opacity: [0, 1],
easing: 'easeOutSine',
begin: () => {
el.classList.remove('d-none');
},
});
}

Expand All @@ -157,7 +152,7 @@ export class Drawer {
'drawer-container': true,
toggle: this.show,
'full-height': this.fullHeight,

Check failure on line 154 in packages/core/src/components/drawer/drawer.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `⏎`
'd-none': true,

}}
style={{
width: this.width === 'auto' ? this.width : `${this.width}rem`,
Expand Down
25 changes: 10 additions & 15 deletions packages/core/src/components/input-group/input-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class InputGroup {

@State() inputPaddingLeft = 0;
@State() inputPaddingRight = 0;

Check failure on line 25 in packages/core/src/components/input-group/input-group.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `··`
startSlotRef: HTMLElement;
endSlotRef: HTMLElement;

private get inputElement() {
return this.hostElement.querySelector('input') as HTMLInputElement;
Expand Down Expand Up @@ -61,6 +64,7 @@ export class InputGroup {
});
}


Check failure on line 67 in packages/core/src/components/input-group/input-group.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `⏎`
componentDidRender() {
this.prepareInputElement();
}
Expand Down Expand Up @@ -100,12 +104,7 @@ export class InputGroup {
}

private startSlotChanged() {
const slot = this.hostElement.shadowRoot.querySelector(
'slot[name="input-start"]'
);

setTimeout(() => {
const startPadding = this.getChildrenWidth(slot);
const startPadding = this.getChildrenWidth(this.startSlotRef);

Check failure on line 107 in packages/core/src/components/input-group/input-group.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `··`

if (startPadding !== 0) {

Check failure on line 109 in packages/core/src/components/input-group/input-group.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `··`
this.inputPaddingLeft = 11 + startPadding;

Check failure on line 110 in packages/core/src/components/input-group/input-group.tsx

View workflow job for this annotation

GitHub Actions / build

Delete `··`
Expand All @@ -130,20 +129,16 @@ export class InputGroup {
this.inputElement.style.backgroundPosition = `left ${left}px center`;
this.inputPaddingLeft += 26;
}
});

}

private endSlotChanged() {
const slot = this.hostElement.shadowRoot.querySelector(
'slot[name="input-end"]'
);
this.inputPaddingRight = 15 + this.getChildrenWidth(this.endSlotRef);

setTimeout(() => {
this.inputPaddingRight = 15 + this.getChildrenWidth(slot);
});
}

private getChildrenWidth(slotElement: Element) {

if (!slotElement) {
return 0;
}
Expand All @@ -166,11 +161,11 @@ export class InputGroup {
return (
<Host class={{ disabled: this.disabled }}>
<div class="group group-start">
<slot name="input-start"></slot>
<slot ref={(el:HTMLElement)=> this.startSlotRef = el} name="input-start"></slot>
</div>
<slot></slot>
<div class="group group-end">
<slot name="input-end"></slot>
<slot ref={(el:HTMLElement)=> this.endSlotRef = el} name="input-end"></slot>
</div>
</Host>
);
Expand Down

0 comments on commit 752cc62

Please # to comment.