I'm investigating 3rd party react with PostCss component
in which I see property isOpen received from outside
import React, { Component } from 'react';
import classNames from 'classnames/bind';
import PropTypes from 'prop-types';
import styles from './Modal.css';
class Modal extends Component {
render() {
const {
isOpen,
} = this.props;
const cx = classNames.bind(styles);
const ModalClassName = cx({
Modal: true,
isOpen: isOpen,
});
return (
<div className={ModalClassName} tabIndex={0}>
... modal content ...
</div>
)
}
}
Modal.propTypes = {
isOpen: PropTypes.bool.isRequired,
};
export default Modal;
in Modal.css I can see style to hide this modal component
:local(.Modal) {
&:not(:local(.isOpen)) {
visibility: hidden;
opacity: 0;
}
}
/* ------------- I miss this one as well ------------- */
:local(.isOpen) {
@media print {
position: static !important;
}
}
Is this isOpen in CSS same variable passed to component as a property or isOpen name just a coincidence?
If yes, how come isOpen is visible within CSS? Could you please give me reference where I read about this.
After useful clarifications from @JAM let me rephrase my question.
How value in Modal property Modal.props.isOpen can trigger css style .isOpen and affect visibility of Modal component. The question is not about classnames library.
:local(.Modal) {
&:not(:local(.isOpen)) {
visibility: hidden;
opacity: 0;
}
}