Description
Introduce name property in customTemplate to even enhances the customTemplate feature where the user need to have separate component TemplateName and the only purpose of the TemplateName component is to provide templates which takes up space.
So the name property provides the user with two option dynamic and user defined name.
-
dynamic - this takes the component name from the template path provided in config and replaces it with the name provided while generation.
For example:
{
"customTemplate": {
"name": "dynamic",
"component": "../HeroAction.tsx",
"style": "../HeroAction.css",
"test": "../HeroAction.test.tsx",
"story": "../HeroAction.stories.tsx"
}
}
Note: Here the component name used in the templates is HeroAction based on the general practice of naming the component file the same as component function, so HeroAction will be replaced with name provided while generation.
-
Custom Name - this can be used when your project doesn't follow the practice of naming the component file the same as component function. So the component name provided for name property will be replaced with the component name provided in the generation.
For example:
{
"customTemplate": {
"name": "Hero",
"component": "../HeroAction.tsx",
"style": "../HeroAction.css",
"test": "../HeroAction.test.tsx",
"story": "../HeroAction.stories.tsx"
}
}
Here the HeroAction.tsx file will have component function named Hero, so component name Hero will be replaced by the component name provided while generation.
Suggested solution
This can be achieved by introducing name property in customTemplate
Alternative
No response
Additional context
No response
Validations
Description
Introduce
nameproperty incustomTemplateto even enhances thecustomTemplatefeature where the user need to have separate component TemplateName and the only purpose of the TemplateName component is to provide templates which takes up space.So the name property provides the user with two option dynamic and user defined name.
dynamic- this takes the component name from the template path provided in config and replaces it with the name provided while generation.For example:
{ "customTemplate": { "name": "dynamic", "component": "../HeroAction.tsx", "style": "../HeroAction.css", "test": "../HeroAction.test.tsx", "story": "../HeroAction.stories.tsx" } }Custom Name - this can be used when your project doesn't follow the practice of naming the component file the same as component function. So the component name provided for name property will be replaced with the component name provided in the generation.
For example:
{ "customTemplate": { "name": "Hero", "component": "../HeroAction.tsx", "style": "../HeroAction.css", "test": "../HeroAction.test.tsx", "story": "../HeroAction.stories.tsx" } }Here the
HeroAction.tsxfile will have component function namedHero, so component nameHerowill be replaced by the component name provided while generation.Suggested solution
This can be achieved by introducing
nameproperty incustomTemplateAlternative
No response
Additional context
No response
Validations