Here's a simple hero component. It properly populates the slotted content, but not the properties of the component itself. What's the correct way to set default properties but favor the content from the Builder CMS?
import { component$, useStyles$, Slot } from '@builder.io/qwik';
import styles from './hero.css?inline';
export interface HeroProps {
image: {
url: string;
alt: string;
}
}
export const defaultProps: HeroProps = {
image: {
url: "https://cdn.builder.io/api/v1/image/assets%2F37ded3b122524a739392c33ac92e0db5%2F33553de4c41a4cfd9176a91f5f907b6f",
alt: "A random image from picsum.photos",
}
}
const Hero = component$<HeroProps>(({image = defaultProps.image}) => {
useStyles$(styles);
return (
<section class="hero">
<img class="hero__image" src={image.url} alt={image.alt}/>
<div class="hero__mask"></div>
<div class="hero__content">
<Slot></Slot>
</div>
</section>
);
});
export default Hero;