mixxorz / slippers

A UI component framework for Django. Built on top of Django Template Language.
https://mitchel.me/slippers/
MIT License
509 stars 37 forks source link

Change suggested component name format to TitleCase #22

Open mixxorz opened 2 years ago

mixxorz commented 2 years ago

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 commented 1 year ago

Hey @mixxorz I did the same thing here haha

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

camelCase:

{% 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.