How To Contribute
Follow the following guidelines to ensure the smooth collaboration
Thank you for your interest in contributing to the Inspira UI project! Your contributions help make this project better for everyone. Please take a moment to read through these guidelines to ensure a smooth collaboration.
Table of Contents
- Getting Started
- Code of Conduct
- How to Contribute
- Project Structure
- Style Guidelines
- Documentation Guidelines
- Testing
- License
Getting Started
- Fork the Repository: Create a personal fork of the project on GitHub.
- Clone Your Fork: Clone your forked repository to your local machine.
- Create a Branch: Create a new branch for your contribution (
git checkout -b feature/YourFeatureName
). - Install Dependencies: Run
npm install
to install all necessary dependencies.
Code of Conduct
By participating in this project, you agree to abide by the Code of Conduct, which aims to foster an open and welcoming environment.
How to Contribute
Reporting Bugs
If you find a bug, please open an issue and include:
- A clear and descriptive title.
- Steps to reproduce the issue.
- Expected and actual results.
- Screenshots or code snippets, if applicable.
Suggesting Enhancements
We welcome suggestions for new features or improvements. Please open an issue and include:
- A clear and descriptive title.
- A detailed description of the enhancement.
- Any relevant examples or mockups.
Adding New Components
We appreciate contributions that add new components to the library. Please ensure that:
- The component is generally useful and aligns with the project's goals.
- The component is compatible with both Nuxt and Vue.
- You follow the coding and documentation guidelines outlined below.
- You include unit tests for your component.
Project Structure
Understanding the project structure is crucial for effective contribution:
- Components Directory:
- Main components should be placed in
components/content/inspira/ui/<component-folder-name>/
. - Example components should be placed in
components/content/inspira/examples/<component-folder-name>/
.
- Main components should be placed in
- Documentation:
- Documentation files are located in the
content/2.components/
directory. - After adding a component, write its documentation in this directory.
- Documentation files are located in the
Style Guidelines
Coding Standards
- Language: All components should be written in Vue.js with TypeScript support.
- Styling: Use Tailwind CSS classes for styling whenever possible.
- Naming Conventions: Use
PascalCase
for component names and filenames.
Component Format
Your Vue components should adhere to the following structure:
Props typing and code style
Refer to this Vue.js documentation page -> https://vuejs.org/api/sfc-script-setup#type-only-props-emit-declarations
Constants, interfaces, types and variants
For reusability purposes, you can also add an index.ts
file at the root of the component folder to export interfaces, constants, and other useful code elements. Keep in mind that developers will copy and paste the component code into their projects, so it should be very easy to customize according to their standards.
Contants have to be CAPS_CAMEL_CASE
in order to identify them clearly inside the code. And prefix
them.
Please never use Enums; use {} as const
instead. 😘
You can check the PatternBackground
component files components/content/inspira/ui/pattern-background
for a complete example.
Notes:
- Use
<script lang="ts" setup>
for TypeScript and the Composition API. - Keep styles scoped to prevent conflicts.
- Ensure compatibility with both Nuxt and Vue.
Commit Messages
- Use the Conventional Commits format.
- Begin with a type (
feat
,fix
,docs
, etc.) followed by a short description. - Example:
feat: add TextHoverEffect component
Documentation Guidelines
Proper documentation is crucial for users to understand and effectively use the components. Follow these guidelines when adding documentation for new components.
Steps to Add a New Component
- Create the Component
- Place the main component in
components/content/inspira/ui/<component-folder-name>/
. - Follow the Component Format specified above.
- If the component requires examples or demos, add demo components to
components/content/inspira/examples/<component-folder-name>/
.
- Place the main component in
- Write Documentation
- Add a new Markdown file in
content/2.components/
for your component's documentation. - Use the appropriate template based on whether your component is single-file or multi-file (see below).
- Mention the Credits and source if the component is ported from any other UI library or taken inspiration from any other source.
- Add a new Markdown file in
- Ensure Compatibility
- Test your component in both Nuxt and Vue environments.
Single-File Components
For components that are contained within a single .vue
file, use the following template:
- Front Matter
Begin with YAML front matter that includes thetitle
anddescription
: - Preview Section
Use theComponentLoader
to display a live preview of the component. Theid
should be set to the folder name of your component incomponents/content/inspira/examples/
. In case, there is no folder, thenid
is not required. - API Documentation
Provide a table listing all props: - Component Code
Include the full code of the component usingCodeViewer
. Theid
should be set to the folder name of your component incomponents/content/inspira/ui/
.
Example:
In this example, the id
used in both ComponentLoader
and CodeViewer
is text-hover-effect
, which matches the folder name where the component and its demo are stored.
Multi-File Components
For components that consist of multiple files, such as a main component and several sub-components or variants, use the following template:
- Front Matter
Begin with YAML front matter: - Preview Sections
Include multipleComponentLoader
sections for each example or variant. Theid
should be set to the folder name of your component incomponents/content/inspira/examples/
. - API Documentation
Provide comprehensive API documentation covering all components: - Utility Classes
If applicable, list any utility classes: - Component Code
Use acode-group
to group multipleCodeViewerTab
components, one for each file. Theid
should be set to the folder name of your component incomponents/content/inspira/ui/
.
Example:
In this example, the id
used in ComponentLoader
and all CodeViewerTab
components is pattern-backgrounds
, which matches the folder name where the components and their demos are stored.
Testing
- Unit Tests: Write unit tests for your component if applicable.
- Cross-Environment Testing: Ensure that your component works correctly in both Nuxt and Vue environments.
- Visual Testing: Check the component visually to ensure it renders correctly.
Additional Notes
- Component Names: Use
PascalCase
for component filenames and names. - IDs: In
CodeViewer
,CodeViewerTab
, andComponentLoader
, theid
parameter should be set to the folder name where the component is stored incomponents/content/inspira/ui/<component-folder-name>/
andcomponents/content/inspira/examples/<component-folder-name>/
. This helps in correctly linking the code and examples in the documentation. - Demo Components: For each component, create a corresponding
Demo
component used in theComponentLoader
for previews, and place it incomponents/content/inspira/examples/<component-folder-name>/
. - Localization: If your component supports multiple languages, include details in the documentation.
License
By contributing, you agree that your contributions will be licensed under the MIT License.