Optimizing Directus Components: Merging and Prop Improvements #370
Closed
Fritsch-Tech
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
When I created this library, I was thinking about providing a default renderer (standard
Can you provide a real usage example?
What about the debate union vs enum then? 🥲 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Discussion/Idea
Merging DirectusAsset and DirectusImage Component: Is there a reason why those are separate?
Directus doesn't explicitly distinguish between them (Reference: Directus Documentation). Considering this, would it be beneficial to merge the DirectusAsset and DirectusImage components into a single component? This could potentially simplify the codebase and improve maintainability.
Change DirectusImage props: Simplifying Transformations
Instead of having multiple separate props for each transformation, why not create a single Directus Transformation Prop that accepts either a Preset or a Custom Transformation (of type string | CustomTransformations)? For backward compatibility, we could retain the existing props in the current npm package. This approach would streamline the documentation, programming, and make the reuse of custom transformations easier. Additionally, it would simplify the implementation of default custom transformers.
Add Enums: Improving Type Safety
Currently, we use unions for everything, but with the above changes, we could introduce enums for better type safety and keep backwards compability. This would help maintain backward compatibility while enhancing the codebase with more robust typing.
By implementing these improvements, we can enhance the component's overall usability and codebase structure. Let's discuss and gather feedback to make informed decisions on these enhancements.
Feel free to share your thoughts and ideas regarding these proposed changes!
Thank you for engaging in this discussion!
Beta Was this translation helpful? Give feedback.
All reactions