Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@storybook/addon-centered
Advanced tools
Storybook Centered Decorator can be used to center components inside the preview in Storybook.
This addon works with Storybook for: React.
npm i @storybook/addon-centered
You can set the decorator locally:
import React from 'react';
import { storiesOf } from '@storybook/react';
import MyComponent from '../Component';
import centered from '@storybook/addon-centered';
storiesOf('MyComponent', module)
.addDecorator(centered)
.add('without props', () => (<MyComponent />))
.add('with some props', () => (<MyComponent text="The Comp"/>));
Or you can also add this decorator globally:
import { configure, addDecorator } from '@storybook/react';
import centered from '@storybook/react-storybook-decorator-centered';
addDecorator(centered);
configure(function () {
//...
}, module);
1 - Configure the extension
import React from 'react';
import { configure, setAddon } from '@storybook/react';
import centered from '@storybook/addon-centered';
setAddon({
addCentered(storyName, storyFn) {
this.add(storyName, (context) => (
centered.call(context, storyFn)
));
}
});
configure(function () {
//...
}, module);
2 - Use it in your story
import React from 'react';
import { storiesOf } from '@storybook/react';
import Component from '../Component';
storiesOf('Component', module)
.addCentered('without props', () => (<Component />))
FAQs
Storybook decorator to center components
The npm package @storybook/addon-centered receives a total of 13,862 weekly downloads. As such, @storybook/addon-centered popularity was classified as popular.
We found that @storybook/addon-centered demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 18 open source maintainers 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.