|
| 1 | +import { vue } from '@fiction/core' |
| 2 | +import { CardTemplate } from '@fiction/site/card' |
| 3 | +import { z } from 'zod' |
| 4 | +import { standardOption } from '../inputSets' |
| 5 | + |
| 6 | +const templateId = 'contact' |
| 7 | + |
| 8 | +export const UserConfigSchema = z.object({ |
| 9 | + layout: z.enum(['left', 'right']).optional().describe('Layout of the card, image on left or right'), |
| 10 | + title: z.string().optional().describe('Primary headline for profile 3 to 8 words'), |
| 11 | + subTitle: z.string().optional().describe('Formatted markdown of profile with paragraphs, 30 to 60 words, 2 paragraphs'), |
| 12 | + superTitle: z.string().optional().describe('Shorter badge above headline, 2 to 5 words'), |
| 13 | + items: z.array(z.object({ |
| 14 | + title: z.string().optional().describe('Title for list of details'), |
| 15 | + items: z.array(z.object({ |
| 16 | + title: z.string().optional(), |
| 17 | + content: z.string().optional(), |
| 18 | + icon: z.string().optional(), |
| 19 | + href: z.string().optional(), |
| 20 | + })).optional().describe('List of details with contact details, location, etc.'), |
| 21 | + })), |
| 22 | + socials: z.array(z.object({ |
| 23 | + name: z.string().optional().describe('@handle on (platform)'), |
| 24 | + href: z.string().optional().describe('Full link for href'), |
| 25 | + icon: z.string().optional().describe('icon reference associated with the social media platform (x, youtube, facebook, etc)'), |
| 26 | + })).optional().describe('List of social media links'), |
| 27 | +}) |
| 28 | + |
| 29 | +export type UserConfig = z.infer<typeof UserConfigSchema> |
| 30 | + |
| 31 | +const options = [ |
| 32 | + standardOption.ai(), |
| 33 | +] |
| 34 | + |
| 35 | +const defaultContent: UserConfig = { |
| 36 | + superTitle: 'Contact', |
| 37 | + title: 'Get In Touch', |
| 38 | + subTitle: `Send me a message and I'll respond within 24 hours.`, |
| 39 | + items: [ |
| 40 | + { |
| 41 | + title: 'Chat with Me', |
| 42 | + items: [ |
| 43 | + { title: 'Send me an email', content: '[email protected]', href: 'mailto:[email protected]', icon: 'i-tabler-mail' }, |
| 44 | + ], |
| 45 | + }, |
| 46 | + { |
| 47 | + title: 'Call Me', |
| 48 | + items: [ |
| 49 | + { title: '+1(888) 888-8888', content: '', href: '#', icon: 'i-tabler-phone' }, |
| 50 | + ], |
| 51 | + }, |
| 52 | + ], |
| 53 | + |
| 54 | + socials: [ |
| 55 | + { name: '@handle on facebook', href: '#', icon: 'facebook' }, |
| 56 | + { name: '@handle on x', href: '#', icon: 'x' }, |
| 57 | + { name: '@handle on linkedin', href: '#', icon: 'linkedin' }, |
| 58 | + ], |
| 59 | +} |
| 60 | + |
| 61 | +export const templates = [ |
| 62 | + new CardTemplate({ |
| 63 | + templateId, |
| 64 | + category: ['form', 'marketing'], |
| 65 | + description: 'A minimal profile card with a splash image, headline, subheading, and contact details.', |
| 66 | + icon: 'i-tabler-user', |
| 67 | + colorTheme: 'blue', |
| 68 | + el: vue.defineAsyncComponent(async () => import('./ElCard.vue')), |
| 69 | + getUserConfig: () => defaultContent, |
| 70 | + isPublic: true, |
| 71 | + options, |
| 72 | + schema: UserConfigSchema, |
| 73 | + demoPage: async () => { |
| 74 | + return { cards: [ |
| 75 | + { templateId, userConfig: { ...defaultContent } }, |
| 76 | + { templateId, userConfig: { ...defaultContent, layout: 'left' as const } }, |
| 77 | + ] } |
| 78 | + }, |
| 79 | + }), |
| 80 | +] as const |
0 commit comments