Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Container selector option #27

Merged
merged 8 commits into from
Sep 25, 2019

Conversation

vkalchuk
Copy link
Contributor

@vkalchuk vkalchuk commented Aug 7, 2019

Hi, thank you for creating this library.

I have the case when I'd like to render the toast message and position it relative to the element within the iframe, so adding ct-container id won't work as document.getElementById('ct-container') is executed in the main window.

This change allows passing an option of a container css selector.

src/index.js Outdated
@@ -9,7 +9,7 @@ import './styles/styles.css';
let ctToastCount = 0;

const cogoToast = (text, options) => {
let rootContainer = document.getElementById('ct-container');
let rootContainer = document.querySelector(options.containerCssSelector) || document.getElementById('ct-container');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change it to toastContainerID, where we could pass the ID instead of a CSS selector

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, makes sense

@anmdotdev anmdotdev merged commit 7ee10bf into Cogoport:master Sep 25, 2019
@vkalchuk vkalchuk deleted the pr/container-selector-option branch September 25, 2019 19:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants