Hey, is there any way to create a generic component in astro.build?
So, I tried to create a component and when I want to call it in another component it should look like this<Card component="section"></Card>
My Card Component:
---
import type { Props as AstroProps } from 'astro';
interface Props extends AstroProps {
variant?: 'light' | 'dark' | 'medium';
}
const { variant = 'light', component: Component = 'section'} = Astro.props as Props;
---
<Component class={variant}>
<slot />
</Component>
And I call it with:
<Card component="div">
...
</Card>
I mean, it works, but I get this error:
Component 'Component' is not a valid component.
If this is a Svelte or Vue component, it might have a syntax error that makes it impossible to parse.ts(2604)