Security News
RubyGems.org Adds New Maintainer Role
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.
@contentful/forma-36-react-components
Advanced tools
This is a version 3 of Forma 36, which is not the current version of the package. From 12th July 2022 it will not be supported anymore. Please install current, supported version 4 of the library
A React component library for Forma 36 design system created by Contentful and powered by Storybook. You can access a Storybook website with the latest changes of the library here
yarn add @contentful/forma-36-react-components
Or
npm install @contentful/forma-36-react-components
import { Input } from '@contentful/forma-36-react-components';
For components in alpha stage, check the instructions in Alpha components
import '@contentful/forma-36-react-components/dist/styles.css';
For local development, in the root of the repo run yarn
to install all dependencies and then yarn build
to build all packages.
This package depends on several other Forma 36 packages so you will need to build all of them.
We use Storybook to create a development environment for our component library. To start it locally run:
yarn storybook
To start working on your components in Storybook, you will need to create stories for them.
Look in the src/components
directory for any .stories.js
file. Storybook will automatically include any files with the .stories.js
file extension.
Storybook is configured at scripts/.storybook/main.js
.
A component's directory should resemble the following:
YourComponent
├── index.js // A file for exporting your component
├── YourComponent.js // Your React component
├── YourComponent.css // Component styles
├── YourComponent.stories.js // Storybook for the component
└── YourComponent.test.js. // Component tests
If you use
yarn generate
in the root of the repo, this structure will be created automatically for you
We are using postcss-preset-env for styling our components. Using postcss-preset-env allows us to use the latest CSS syntax without having to wait for browser support. tools/postcss.config.js
is used for adding plugins and configuration.
We follow a number of principles when creating our components:
We follow the principle that a component should only be responsible for its own internal spacing - never external spacing. This means that we're flexible in where our components can be used without having to override margins.
We recommend the following naming convention for PropTypes to make them as clear as possible:
numItems
, itemCount
, itemIndex
isVisible
, canExpand
, hasImage
items
item
containerNode
triggerElement
onOpen
, onClick
We would like to make sure that every component contains a README file with recommendations and guidelines. Using yarn add-readme
it will generate a template README file for you for the component that you specify. Follow steps in the CLI to create new README.
Make sure that your documentation for the component contains following parts:
We are using Jest and Testing Library to test our components.
Tests are kept next to their components and use the .test.js
file extension.
yarn test
It is recommended to run tests in development with the optional --watch
flag.
yarn test --watch
We are using a combination of Webpack and Babel to create builds of our component library. We use Webpack with the tools/webpack.production.config.js
config to build a stylesheet including all CSS used for our components using the ExtractTextPlugin. Babel is used for transpiling our React components into CommonJS modules. Babel and Webpack both output the build to the dist
directory.
yarn build
This project uses the Angular JS Commit Message Conventions, via semantic-release. See the semantic-release Default Commit Message Format section for more details.
You can commit the changes by running
yarn commit
We provide a number of alpha components which are unsupported and subject to breaking changes without warning. In short - use alpha components at your own risk.
Alpha components are provided outside of the main component library bundle and can be used as follows:
import { MyAlphaComponent } from '@contentful/forma-36-react-components/dist/alpha';
FAQs
Contentful UI Component Library
We found that @contentful/forma-36-react-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 120 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
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.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.