Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"name" property in custom template #118

Open
4 tasks done
jitiendran opened this issue Sep 17, 2023 · 1 comment
Open
4 tasks done

"name" property in custom template #118

jitiendran opened this issue Sep 17, 2023 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request p3-enhancement Enhancement under consideration
Milestone

Comments

@jitiendran
Copy link
Member

jitiendran commented Sep 17, 2023

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

@jitiendran
Copy link
Member Author

[Triaged] Good to start the development 👍🏻

@jitiendran jitiendran added documentation Improvements or additions to documentation enhancement New feature or request p3-enhancement Enhancement under consideration and removed enhancement: pending triage labels Sep 17, 2023
@jitiendran jitiendran added this to the v0.1.6 milestone Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request p3-enhancement Enhancement under consideration
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant