![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Accessible modal dialog component on react-rails.
Before using react_rails_modal, install react-rails
.
Add react-rails
to your gemfile:
gem 'react-rails'
And install:
$ bundle install
Next, run the installation script:
$ rails g react:install
Add react_rails_modal
to your gemfile:
gem 'react_rails_modal'
And install:
$ bundle install
Next, run the installation script:
$ rails g react_rails_modal:install
This will place the following in your application.js
:
//= require react_rails_modal
<ModalComponent
isOpen={bool}
onCloseRequest={requestCloseFunction}
style={customStyle}
>
<h1>Modal Component Content</h1>
<p>Text</p>
</ModalComponent>
In app/controller/views/:
<%= react_component('Hello') %>
Styles are passed as an object with 2 keys, 'overlay' and 'modal'.
In app/assets/javascripts/components/:
class Hello extends React.Component {
constructor(props) {
super(props);
this.closeModal = this.closeModal.bind(this);
this.openModal = this.openModal.bind(this);
this.state = { isModalOpen: false };
}
closeModal() {
this.setState({ isModalOpen: false });
}
openModal() {
this.setState({ isModalOpen: true });
}
render () {
return (
<div>
<button onClick={this.openModal}>Open Modal</button>
<ModalComponent
isOpen={this.state.isModalOpen}
onCloseRequest={this.closeModal}
style={Hello.styles}
>
<h1>Hello world!</h1>
<button onClick={this.closeModal}>Close</button>
</ModalComponent>
</div>
);
}
}
Hello.styles = {
overlay: {
backgroundColor: 'rgba(0,0,0,0.75)',
bottom: '0',
height: '100%',
position: 'fixed',
top: '0',
left: '0',
right: '0',
width: '100%',
zIndex: '1',
},
modal: {
background: '#fff',
left: '5%',
padding: '15px 30px',
position: 'relative',
top: '10%',
width: '80%',
zIndex: '2',
}
}
If you want to use css classes, you can pass overlayClass and modalClass props to the Modal.
class HelloTwo extends React.Component {
constructor(props) {
super(props);
this.closeModal = this.closeModal.bind(this);
this.openModal = this.openModal.bind(this);
this.state = { isModalOpen: false };
}
closeModal() {
this.setState({ isModalOpen: false });
}
openModal() {
this.setState({ isModalOpen: true });
}
render () {
return (
<div>
<button onClick={this.openModal}>Open Modal</button>
<ModalComponent
isOpen={this.state.isModalOpen}
onCloseRequest={this.closeModal}
overlayClass='overlayClass'
modalClass='modalClass'
>
<h1>Hello world!!</h1>
<button onClick={this.closeModal}>Close</button>
</ModalComponent>
</div>
);
}
}
In app/assets/stylesheets/:
.overlayClass {
background-color: rgba(0,0,0,0.7);
bottom: 0;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
z-index: 1;
}
.modalClass {
background: #fff;
left: 5%;
padding: 15px;
position: fixed;
top: 10%;
width: 90%;
z-index: 2;
}
rake react_rails_modal:build
rake spec
FAQs
Unknown package
We found that react_rails_modal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.