radix-vue / shadcn-vue

Vue port of shadcn-ui
https://www.shadcn-vue.com/
MIT License
4.57k stars 262 forks source link

Feature(Docs): Add a SelectMenu for user's framework #538

Closed MuhammadM1998 closed 3 months ago

MuhammadM1998 commented 4 months ago

Describe the feature

Adding a SelectMenu with the frameworks as options (Vue, Nuxt, Astro, ...) and adjusting the components code accordingly would simplify copying the code a lot. It can be added besides 'Components Path' and 'Utils Path' in the current code config side menu

Example for the Button component:


- User selected 'Nuxt'. Will remove the import as the component is auto imported
```vue
<template>
  <UiButton>Button</UiButton>
</template>

Maybe it's a nitpick because ultimately we have only two options. Vue in Vue, Laravel, Astro projects and Nuxt. But I created an issue as I might try to implement it If I had the time 😁

Additional information

dogukanoksuz commented 4 months ago

In NuxtJs we can already import without writing Ui in front of components. image

Are you sure you imported shadcn-nuxt plugin on nuxt.config.ts file?

{
 modules: ['shadcn-nuxt'],
 shadcn: {
    /**
     * Prefix for all the imported component
     */
    prefix: '',
    /**
     * Directory that the component lives in.
     * @default "./components/ui"
     */
    componentDir: './components/ui'
  },
}
MuhammadM1998 commented 4 months ago

@dogukanoksuz I know about the prefix thanks but it's just an example about how the import can be removed in Nuxt not the component name

dogukanoksuz commented 4 months ago

@dogukanoksuz I know about the prefix thanks but it's just an example about how the import can be removed in Nuxt not the component name

You dont need to copy imports when you install plugin. Just copy component code and it works.

sadeghbarati commented 4 months ago

@dogukanoksuz, let me clarify what @MuhammadM1998's goal is.

The current documentation uses imports in markdown, as shown in the image:

image

As the title suggests, it's a feature for users to select their framework of choice. For instance, if a user selects Nuxt, those imports should be removed from the markdown code

sadeghbarati commented 3 months ago

https://twitter.com/Ignace_Maes/status/1800464315604213964?s=19

Vue docs toggle CAPI & OAPI is idea to handle this 💯

MuhammadM1998 commented 3 months ago

You're right I thought of it then saw shadcn-docs already handles componentsPath & utlisPath in in ComponentPreview component which is basically the same idea as this. What to do you think?

sadeghbarati commented 3 months ago

If the ComponentPreview way is simpler, then let's go with shadcn-docs way

MuhammadM1998 commented 3 months ago

I wanted to start with cli's internal refactors first & loading components config by nuxt module but it seem they would need some time . I will give this a try asap!

sadeghbarati commented 3 months ago

I wanted to start with cli's internal refactors first & loading components config by nuxt module but it seem they would need some time . I will give this a try asap!

@MuhammadM1998

I'll take care of this then, if I could

Can you share the shadcn-docs way? Thanks

MuhammadM1998 commented 3 months ago

@sadeghbarati I still need to think about it. I'll ping you when I get to something

zernonia commented 3 months ago

@MuhammadM1998 I think this is abit extra tho.. User can simply remove tho import right? Maybe 1 or 2 second max per component copied?

MuhammadM1998 commented 3 months ago

@zernonia less steps is always better imo 😁 It gets tedious as one component may have multiple .vue files. But it's up to you guys of course.

sadeghbarati commented 3 months ago

I think this is abit extra tho..

Yeah, I'm thinking again this can cause confusion for new devs, Let's keep it as is

@MuhammadM1998 Feel free to close the issue if you don't worked on it