Skip to content

Commit d05ced8

Browse files
committed
test(action-sheet): strip 1
1 parent 1415d7b commit d05ced8

File tree

1 file changed

+38
-79
lines changed

1 file changed

+38
-79
lines changed

core/src/components/action-sheet/action-sheet.tsx

Lines changed: 38 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { getClassMap } from '@utils/theme';
2020

2121
import { getIonMode } from '../../global/ionic-global';
22-
import type { AnimationBuilder, CssClassMap, FrameworkDelegate, OverlayInterface } from '../../interface';
22+
import type { AnimationBuilder, FrameworkDelegate, OverlayInterface } from '../../interface';
2323
import type { OverlayEventDetail } from '../../utils/overlays-interface';
2424

2525
import type { ActionSheetButton } from './action-sheet-interface';
@@ -253,17 +253,17 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
253253
return eventMethod(this.el, 'ionActionSheetWillDismiss');
254254
}
255255

256-
private async buttonClick(button: ActionSheetButton) {
257-
const role = button.role;
258-
if (isCancel(role)) {
259-
return this.dismiss(button.data, role);
260-
}
261-
const shouldDismiss = await this.callButtonHandler(button);
262-
if (shouldDismiss) {
263-
return this.dismiss(button.data, button.role);
264-
}
265-
return Promise.resolve();
266-
}
256+
// private async buttonClick(button: ActionSheetButton) {
257+
// const role = button.role;
258+
// if (isCancel(role)) {
259+
// return this.dismiss(button.data, role);
260+
// }
261+
// const shouldDismiss = await this.callButtonHandler(button);
262+
// if (shouldDismiss) {
263+
// return this.dismiss(button.data, button.role);
264+
// }
265+
// return Promise.resolve();
266+
// }
267267

268268
private async callButtonHandler(button: ActionSheetButton | undefined) {
269269
if (button) {
@@ -359,9 +359,9 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
359359
render() {
360360
const { header, htmlAttributes, overlayIndex } = this;
361361
const mode = getIonMode(this);
362-
const allButtons = this.getButtons();
363-
const cancelButton = allButtons.find((b) => b.role === 'cancel');
364-
const buttons = allButtons.filter((b) => b.role !== 'cancel');
362+
// const allButtons = this.getButtons();
363+
// const cancelButton = allButtons.find((b) => b.role === 'cancel');
364+
// const buttons = allButtons.filter((b) => b.role !== 'cancel');
365365
const headerID = `action-sheet-${overlayIndex}-header`;
366366

367367
return (
@@ -388,61 +388,20 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
388388
<div tabindex="0"></div>
389389

390390
<div class="action-sheet-wrapper ion-overlay-wrapper" ref={(el) => (this.wrapperEl = el)}>
391-
<div class="action-sheet-container">
392-
<div class="action-sheet-group" ref={(el) => (this.groupEl = el)}>
393-
{header !== undefined && (
394-
<div
395-
id={headerID}
396-
class={{
397-
'action-sheet-title': true,
398-
'action-sheet-has-sub-title': this.subHeader !== undefined,
399-
}}
400-
>
401-
{header}
402-
{this.subHeader && <div class="action-sheet-sub-title">{this.subHeader}</div>}
403-
</div>
404-
)}
405-
{buttons.map((b) => (
406-
<button
407-
{...b.htmlAttributes}
408-
type="button"
409-
id={b.id}
410-
class={buttonClass(b)}
411-
onClick={() => this.buttonClick(b)}
412-
disabled={b.disabled}
413-
tabIndex={b.disabled ? -1 : 0}
414-
>
415-
<span class="action-sheet-button-inner">
416-
{b.icon && <ion-icon icon={b.icon} aria-hidden="true" lazy={false} class="action-sheet-icon" />}
417-
{b.text}
418-
</span>
419-
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
420-
</button>
421-
))}
422-
</div>
423-
424-
{cancelButton && (
425-
<div class="action-sheet-group action-sheet-group-cancel">
426-
{/*
427-
Cancel buttons intentionally do not
428-
receive a disabled state here as we should
429-
not make it difficult to dismiss the overlay.
430-
*/}
431-
<button
432-
{...cancelButton.htmlAttributes}
433-
type="button"
434-
class={buttonClass(cancelButton)}
435-
onClick={() => this.buttonClick(cancelButton)}
436-
>
437-
<span class="action-sheet-button-inner">
438-
{cancelButton.icon && (
439-
<ion-icon icon={cancelButton.icon} aria-hidden="true" lazy={false} class="action-sheet-icon" />
440-
)}
441-
{cancelButton.text}
442-
</span>
443-
{mode === 'md' && <ion-ripple-effect></ion-ripple-effect>}
444-
</button>
445-
</div>
391+
<div class="action-sheet-head">
392+
{header !== undefined && (
393+
<h2
394+
id={headerID}
395+
class={{
396+
'action-sheet-title': true,
397+
'action-sheet-has-sub-title': this.subHeader !== undefined,
398+
}}
399+
>
400+
{header}
401+
</h2>
402+
)}
403+
{this.subHeader !== undefined && (
404+
<h2 class="action-sheet-sub-title">{this.subHeader}</h2>
446405
)}
447406
</div>
448407
</div>
@@ -453,12 +412,12 @@ export class ActionSheet implements ComponentInterface, OverlayInterface {
453412
}
454413
}
455414

456-
const buttonClass = (button: ActionSheetButton): CssClassMap => {
457-
return {
458-
'action-sheet-button': true,
459-
'ion-activatable': !button.disabled,
460-
'ion-focusable': !button.disabled,
461-
[`action-sheet-${button.role}`]: button.role !== undefined,
462-
...getClassMap(button.cssClass),
463-
};
464-
};
415+
// const buttonClass = (button: ActionSheetButton): CssClassMap => {
416+
// return {
417+
// 'action-sheet-button': true,
418+
// 'ion-activatable': !button.disabled,
419+
// 'ion-focusable': !button.disabled,
420+
// [`action-sheet-${button.role}`]: button.role !== undefined,
421+
// ...getClassMap(button.cssClass),
422+
// };
423+
// };

0 commit comments

Comments
 (0)