The function withProps
from the npm package evokit, set the default props for block
For examples, consider the use on the Link block.
import { withProps } from 'evokit';
import { Link } from 'evokit-link';
const LinkNofollow = withProps(Link, {
'link-color': 'gray',
rel: 'nofollow'
});
// input:
<LinkNofollow href='#' />
// output:
<a href='#' class='ek-link ek-link_color_gray' rel='nofollow' />
// input:
<LinkNofollow href='#' link-color='red' rel='help' />
// output:
<a href='#' class='ek-link ek-link_color_red' rel='help' />
// input:
<LinkNofollow href='#' link-color={null} rel={null} />
// output:
<a href='#' class='ek-link' />