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

Change suggested component name format to TitleCase #22

Open
mixxorz opened this issue Oct 29, 2022 · 1 comment
Open

Change suggested component name format to TitleCase #22

mixxorz opened this issue Oct 29, 2022 · 1 comment

Comments

@mixxorz
Copy link
Owner

mixxorz commented Oct 29, 2022

This issue proposes changing the suggested name format of components to TitleCase from snake_case to improve readability by being distinct from normal template tags, keyword arguments, and variables.

{% #Quote %}
  {% QuotePhoto src="/project-hail-mary.jpg" %}

  {% #QuoteText %}
    “I penetrated the outer cell membrane with a nanosyringe."
    "You poked it with a stick?"
    "No!" I said. "Well. Yes. But it was a scientific poke
    with a very scientific stick.”
  {% /QuoteText %}

  {% #QuoteAttribution %}
    Andy Weir, Project Hail Mary
  {% /QuoteAttribution %}
{% /Quote %}

Open to feedback on this.

@luanfonceca
Copy link

luanfonceca commented Dec 26, 2022

Hey @mixxorz I did the same thing here haha

Here's the patterns I'm following:
Titlecase:

  • Components

camelCase:

  • fragment alias
  • component alias
{% QuotePhoto src="/project-hail-mary.jpg" as quotePhoto %}

{% #Quote %}
  {{ quotePhoto }}

  {% #QuoteText %}
    “I penetrated the outer cell membrane with a nanosyringe."
    "You poked it with a stick?"
    "No!" I said. "Well. Yes. But it was a scientific poke
    with a very scientific stick.”
  {% /QuoteText %}

  {% #QuoteAttribution %}
    Andy Weir, Project Hail Mary
  {% /QuoteAttribution %}
{% /Quote %}

I found the alias pretty handy when passing components as props to other components, same when you have the same component in several places, so I just need to "parse" it once.

I have a mixed feeling because this goes against the Django convention, but was pretty nice to differentiate components and includes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants