Skip to content

Commit

Permalink
fix: create class to html too
Browse files Browse the repository at this point in the history
  • Loading branch information
jowjow22 committed Sep 27, 2024
1 parent 3839dd5 commit 8f18904
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ To locally test Atomium using Alpha/Beta versions, follow the steps below:

1. Update the `.release-please-manifest.json` file in the root directory of the Atomium project with the next version number + alpha. Ex: the current version is `2.10.0`, so the next alpha version can be `2.11.0-alpha.1` (OBS: in the example, it is updating only the core lib, update the libs that your changes impact).

![add alpha version to release](https://github.com/user-attachments/assets/3e3adaa2-1bcd-4442-8d1a-118cc14cc274)
![add alpha version to release](https://github.com/user-attachments/assets/91418116-266c-45f1-9cf2-bdf2d6c1a7eb)

2. Add the same version to the repespective `package.json` file in the root directory of the lib project. Ex: packages/core/package.json

![add alpha to package](https://github.com/user-attachments/assets/3e3adaa2-1bcd-4442-8d1a-118cc14cc274)
![add alpha to package](https://github.com/user-attachments/assets/ec4bfbf2-a822-4cf5-b7c4-66575fd36230)

3. Build the Atomium libraries by running the following command in the root directory of the Atomium project

Expand Down
27 changes: 8 additions & 19 deletions packages/core/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import {
Component,
Event,
EventEmitter,
Host,
Prop,
Watch,
h,
} from '@stencil/core'
import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core'

import { IconProps } from '../../icons'

type AlertType = Record<'alert' | 'error', { icon: IconProps; color: string }>

/* @todo it's needed to prevent a ionic error. In the version 8.0 it was fixed, remove it after the upgrade.
* https://github.com/ionic-team/ionic-framework/issues/23942
*/
const BACKDROP_NO_SCROLL = 'backdrop-no-scroll'

type HTMLAtomModalElement = HTMLIonModalElement & { close: () => Promise<void> }
Expand Down Expand Up @@ -44,13 +33,6 @@ export class AtomModal {
@Event() atomPrimaryClick: EventEmitter
@Event() atomSecondaryClick: EventEmitter

@Watch('isOpen')
watchPropHandler(newValue: boolean) {
if (newValue) {
document.body.classList.add(BACKDROP_NO_SCROLL)
}
}

private modal: HTMLAtomModalElement

private readonly alertMap: AlertType = {
Expand All @@ -65,12 +47,16 @@ export class AtomModal {
}

componentDidLoad() {
/* @todo it's needed to prevent a ionic error. In the version 8.0 it was fixed, remove it after the upgrade.
* https://github.com/ionic-team/ionic-framework/issues/23942
*/
document.body.classList.remove(BACKDROP_NO_SCROLL)

this.modal.close = async () => {
await this.modal.dismiss()

document.body.classList.remove(BACKDROP_NO_SCROLL)
document.documentElement.classList.remove(BACKDROP_NO_SCROLL)
}
}

Expand All @@ -80,6 +66,9 @@ export class AtomModal {

private readonly handleDidPresent = () => {
this.atomDidPresent.emit(this.modal)

document.body.classList.add(BACKDROP_NO_SCROLL)
document.documentElement.classList.add(BACKDROP_NO_SCROLL)
}

private readonly handleCloseClick = async () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/global/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@ Issue: https://github.com/ionic-team/ionic-framework/issues/27500
}
}
}

html.backdrop-no-scroll {
overflow: hidden;
}

0 comments on commit 8f18904

Please sign in to comment.