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

[Feature]: Prepend all components with Tnt... #80

Open
1 task done
thombruce opened this issue Aug 14, 2024 · 2 comments
Open
1 task done

[Feature]: Prepend all components with Tnt... #80

thombruce opened this issue Aug 14, 2024 · 2 comments
Assignees
Labels

Comments

@thombruce
Copy link
Owner

Feature request

As of now, there are several components which are prepended with TNT. These predominantly are form components which were named as such due to conflicts with native HTML elements (plus TntImg because of a similar naming conflict).

This has created a division between Tnt*-prepended components and non-prepended ones.

We call TntCombobox when we want the combobox form element, but just Breadcrumbs when we want breadcrumbs?

It's confusing.

Since we can't overwrite native HTML (much of which is actually consumed by our components, so conflicts and loops aplenty if that would even work), we should prepend all TNT components with Tnt to avoid the confusion.

One exception (technically a case where we'll alias our components): Where possible, TNT Content will still provide un-prepended components. We should look into whether there is a better way to alias component names than what I've been doing (creating components that just reroute to other ones). Quick googling doesn't turn up anything.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@thombruce thombruce added the type: enhancement New feature or request label Aug 14, 2024
@thombruce thombruce self-assigned this Aug 14, 2024
@thombruce
Copy link
Owner Author

Alternative to prepending where necessary for TNT Content is to... come up with synonyms. For instance, VeeValidate does this calling their input implementation Field instead.

@thombruce
Copy link
Owner Author

Was making a start on this and came across my handling of the Nuxt Icon module. Presently we're using the defaults: The Icon component is accessible via Icon(name="") or :icon{name=""} in markdown.

Other common components that aren't prepended with Tnt include... Breadcrumbs, PrevNext...

But I think we want to handle Icon first and handle it separately.

The ideal outcome would be that we'd have TntIcon instead of Icon but we'd still be able to use :icon{} in markdown documents. This should be pretty straightforward; we can change the global name of the icon component like so...

export default defineNuxtConfig({
  icon: {
    componentName: 'TntIcon'
  }
})

...and then in a components/content/Icon.vue file, do something like...

TntIcon(v-bind="$props")

Something like that.


Alternative to this, and simpler, is to create a components/global/TntIcon.vue component that does the opposite:

Icon(v-bind="$props")

This would maintain the existing functionality while offering a new, namespaced approach so that we can gracefully deprecate the former handling.

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

Successfully merging a pull request may close this issue.

1 participant