Skip to content

Components Vue Composition API #27

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

Merged
merged 212 commits into from
Apr 23, 2025
Merged

Conversation

lukas-pierce
Copy link
Collaborator

This PR includes multiple improvements and refactors to align components with modern Vue standards:

  • ✅ Rewrote the remaining components in the compounds folder using
    the modern Vue SFC syntax (<script setup lang="ts">).
  • ✅ For Dropdown.vue:
    • Replaced old value prop with the new modelValue prop.
    • Implemented outside click handling to close the dropdown properly.
  • ✅ Disabled Biome linting for tsconfig.json (due to comments being flagged).
  • ✅ Added a reusable composable: onClickOutside.ts
    • Used in both Autocomplete.vue and Dropdown.vue for outside click detection.
  • ✅ Introduced a generic store for Tabs.vue and Steps.vue to simplify shared state management.
  • 🛠️ Fixed default toast position to bottom-right (Issue #12)

@lukas-pierce lukas-pierce requested a review from skaptox April 22, 2025 16:35
Copy link
Collaborator

@AbsoluteC2H6O AbsoluteC2H6O left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I provide a feedback to improve the code to be more readable. So please try to improve or tell me if it's not necessary.

@@ -4,6 +4,7 @@
</template>

<script>
// todo delete
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for todo delete ? is a dead code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is a non-existent component HelloWorld.vue used there, and besides, there is another App.vue

name: "VCardContent",
};
<script setup lang="ts">
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can those '//' be removed?

name: "VCardFooterItem",
};
<script setup lang="ts">
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can those '//' be removed?

name: "VCardImage",
};
<script setup lang="ts">
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can those '//' be removed?

name: "VMenu",
};
<script setup lang="ts">
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can those '//' be removed?

const toggle = (isHeaderTrigger) => {
if (props.disabled) return;
const state = reactive({
isExpanded: props.expanded,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code works, but Can I suggest use computed props for props in state? something like:

const isExpanded = ref(props.expanded);
// Access props directly: props.hover, props.isLink

same for hover, isLink and isExpanded props.

for best practices but it didn't affect functionality.

name: "VAccordionMenu",
};
<script setup lang="ts">
//
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we delete those '//'?

},
success(message: string, options: ToastOptions = {}) {
options.type = "is-success";
return this.show(message, options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should be more readable is you do this:

success(message: string, options: ToastOptions = {}) {
return this.show(message, { ...options, type: "is-success" });
}

but it works.

},
warning(message: string, options: ToastOptions = {}) {
options.type = "is-warning";
return this.show(message, options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above for other items.

},
};
<script setup lang="ts">
defineProps<{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please try to do this in a best verbose mode, union types? my suggestion is:

// Before: Verbose union types
size?: "is-1" | "is-2" | ... | "is-one-fifth"

// After: Use type aliases
type ColumnSize =
| is-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
| "is-three-quarters"
| "is-two-thirds"
| "is-half"
| "is-one-third"
| "is-one-quarter"
| "is-full"
| is-${"four" | "three" | "two" | "one"}-fifths;

type ColumnOffset = is-offset-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12};
type NarrowBreakpoint = is-narrow-${"mobile" | "tablet" | "touch" | "desktop" | "widescreen" | "fullhd"};

try and let me know if it works better, The code should be more readable.

- Update menu item click handlers
- Fix aria attributes for accessibility
@skaptox skaptox merged commit 3744a79 into master Apr 23, 2025
1 check passed
@skaptox skaptox deleted the components-vue-composition-api branch April 23, 2025 05:43
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

Successfully merging this pull request may close these issues.

3 participants