const body = (props, children) => {
return VStack([
Text(props.title)
.font(18)
.fontWeight('bold'),
Text(props.description)
.foregroundStyle(Color('gray')),
...children
])
.padding(16)
.background(Color(props.backgroundColor || 'white'))
.cornerRadius(8)
.shadow({ radius: 2 })
}
const metadata = {
title: 'Info Card',
description: 'A card component for displaying information',
category: 'Layout',
public: true
}
const properties = {
title: {
type: 'string',
defaultValue: 'Card Title',
title: 'Title',
description: 'The main heading of the card'
},
description: {
type: 'string',
defaultValue: 'Card description',
title: 'Description'
},
backgroundColor: {
type: 'string',
defaultValue: 'white',
title: 'Background Color'
}
}
const previews = [
InfoCard({
title: 'Welcome',
description: 'This is a preview'
}),
InfoCard({
title: 'Alert',
description: 'Important message',
backgroundColor: 'yellow'
})
]
exports.default = defineComponent({
body,
metadata,
properties,
previews
})