Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@okam/directus-block
Advanced tools
This library was generated with Nx.
Run nx build directus-block
to build the library.
TBlockSerializerProps
containing the actual blocks data. This is the prop that will be used by the block dispatcher to iterate through its children.TBlockSerializerProps
as props. Will use BlockSerializer alone by default. This is useful in scenarios where you want every block to be wrapped in other components: <BlockDispatcher config={baseBlockDispatcherConfig} blocks={blocks}>
{(block) => (
<Container tokens={{ isLowestContainerLevel: true }}>
<ErrorBoundary fallback={<ErrorFallback />}>
<BlockSerializer {...block} />
</ErrorBoundary>
</Container>
)}
</BlockDispatcher>
This would allow to remove a lot of repetitive code accross blocks definitions, for example as they all need to be wrapped in a Container
and an ErrorBoundary
This component calls the good component in the configuration from the collection
prop
id
, be null (in that case, the id
will need to be sent using the block's variables). If item
only contains the id, it will be sent to the variables for making the queryA configuration uses the components
prop to map a key value, like so:
const config = {
components: {
block_wysiwyg: {
default: (props) => <BlockWysiwyg {...props} />,
document: BlockWysiwygDocument,
defaultVariant: 'reversed',
getVariant: (props) => props.settings.variants,
variants: {
reversed: (props) => (
<ReversedThemeProvider>
<BlockWysiwyg {...props} />
</ReversedThemeProvider>
)
}
}
}
}
default
prop, instead mapping the default component on a specific variant{[variant]: component}
import { blockWysiwygConfig } from '@okam/directus-block'
const brandConfig = {
components: {
block_wysiwyg: {
document: BlockWysiwygDocument,
...blockWysiwygConfig.block_wysiwyg,
},
block_image: {
default: (props) => <BrandBlockImage {...props} />
},
},
}
<BlockDispatcher config={brandConfig} />
To override the base block dispatcher configuration, you name a block component configuration with the same key as the ones in the configuration.
For example, if this is the base configuration:
const baseConfig = {
components: {
block_wysiwyg: {
default: (props) => <BlockWysiwyg {...props}>,
},
block_hero: {
default: (props) => <BlockHero {...props}>,
},
},
}
But that you to call a branded wysiwyg component from the dispatcher configuration, you may pass the following configuration:
const brandConfig = {
components: {
block_wysiwyg: {
default: (props) => <BrandBlockWysiwyg {...props} />
},
block_image: {
default: (props) => <BrandBlockImage {...props} />
},
},
}
<BlockDispatcher config={brandConfig} />
In this example, the BlockWysiwyg definition would be overriden. However, you would now also have access to the block_image
, and still retain access to the block_hero
You could also re-use only a part of the base configuration while overriding another part
import { blockWysiwygConfig } from '@okam/directus-block'
const brandConfig = {
components: {
block_wysiwyg: {
default: (props) => <BrandBlockWysiwyg {...props} />,
variants: blockWysiwygConfig.block_wysiwyg.variants,
},
block_image: {
default: (props) => <BrandBlockImage {...props} />
},
},
}
<BlockDispatcher config={brandConfig} />
Some blocks may be in the Stack without being in the base configuration. To use them, simply import their own configuration from the stack and spread them in yours
import { blockHeroConfig } from '@okam/directus-block'
const brandConfigWithStackBlocks = {
components: {
block_image: {
default: (props) => <BrandBlockImage {...props} />
},
...blockHeroConfig,
}
}
FAQs
This library was generated with [Nx](https://nx.dev).
The npm package @okam/directus-block receives a total of 140 weekly downloads. As such, @okam/directus-block popularity was classified as not popular.
We found that @okam/directus-block demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.