-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plasma-core): refactor in PopupBase/ModalBase
- Loading branch information
Showing
14 changed files
with
182 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export { PopupBaseProvider, PopupBaseContext } from '@salutejs/plasma-hope'; | ||
export { PopupBaseProvider, usePopupBaseContext } from '@salutejs/plasma-hope'; | ||
export type { PopupInfo, PopupContextType } from '@salutejs/plasma-hope'; | ||
|
||
export { PopupBase } from '@salutejs/plasma-hope'; | ||
export type { PopupBaseProps, PopupBasePlacement } from '@salutejs/plasma-hope'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/plasma-core/src/components/ModalBase/ModalBaseContext.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { PopupInfo } from '../PopupBase/PopupBaseContext'; | ||
|
||
export interface ModalInfo extends PopupInfo { | ||
id: string; | ||
info?: { | ||
isModal?: true; | ||
}; | ||
} | ||
|
||
/** | ||
* Взаимодействие с модальными оконами. | ||
*/ | ||
const getLastModal = (items: ModalInfo[]) => { | ||
const modals = items.filter((item: ModalInfo) => item?.info?.isModal); | ||
const lastModal = modals && (modals[modals.length - 1] as ModalInfo); | ||
return lastModal; | ||
}; | ||
|
||
export const getIdLastModal = (items: ModalInfo[]) => { | ||
return getLastModal(items)?.id; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.