A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/ui/components/app/metamask-translation/README.mdx

37 lines
1.7 KiB

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import MetaMaskTranslation from '.';
# MetaMask Translation
MetaMaskTranslation is a simple helper component for adding full translation
support to the template system. We do pass the translation function to the
template getValues function, but passing it React components as variables
would require React to be in scope, and breaks the object pattern paradigm.
This component gets around that by converting variables that are templates
themselves into tiny React trees. This component does additional validation
to make sure that the tree has a single root node, with maximum two leaves.
Each subnode can have a maximum of one child that must be a string.
This enforces a maximum recursion depth of 2, preventing translation strings
from being performance hogs. We could further limit this, and also attenuate
the safeComponentList for what kind of components we allow these special
trees to contain.
<Canvas>
<Story id="ui-components-app-metamask-translation-metamask-translation-stories-js--default-story" />
</Canvas>
## Component API
<!--
ArgsTable doesn't work with SectionShape
<ArgsTable of={MetaMaskTranslation} />
-->
| Name | Description |
| ---------------- | ------------------------------------------------------------------------------------------------------- |
| `translationKey` | Translation object key `string` |
| `variables` | Array of variables for the MetaMaskTranslation. Can be an array of `string`, `number` or `SectionShape` |